Browse Source

Move all remaining colors into CSS variables (#21903)

This should eliminate all non-variable color usage in the styles, making
gitea fully themeable via CSS variables. Also, it adds a linter to
enforce variables for colors.
tags/v1.19.0-rc0
silverwind 1 year ago
parent
commit
ee21d5453f
No account linked to committer's email address

+ 11
- 0
.stylelintrc.yaml View File

extends: stylelint-config-standard extends: stylelint-config-standard


plugins:
- stylelint-declaration-strict-value

overrides: overrides:
- files: ["**/*.less"] - files: ["**/*.less"]
customSyntax: postcss-less customSyntax: postcss-less
- files: ["**/*.less"]
rules:
scale-unlimited/declaration-strict-value: [color, {
ignoreValues: /^(inherit|transparent|unset|initial)$/
}]
- files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"]
rules:
scale-unlimited/declaration-strict-value: null


rules: rules:
alpha-value-notation: null alpha-value-notation: null

+ 120
- 0
package-lock.json View File

"postcss-less": "6.0.0", "postcss-less": "6.0.0",
"stylelint": "14.15.0", "stylelint": "14.15.0",
"stylelint-config-standard": "29.0.0", "stylelint-config-standard": "29.0.0",
"stylelint-declaration-strict-value": "1.9.1",
"svgo": "3.0.2", "svgo": "3.0.2",
"updates": "13.2.1", "updates": "13.2.1",
"vitest": "0.25.2" "vitest": "0.25.2"
"node": ">= 8" "node": ">= 8"
} }
}, },
"node_modules/css-color-names": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
"integrity": "sha512-zj5D7X1U2h2zsXOAM8EyUREBnnts6H+Jm+d1M2DbiQQcUtnqgQsMrdo8JW9R80YFUmIdBZeMu5wvYM7hcgWP/Q==",
"dev": true,
"engines": {
"node": "*"
}
},
"node_modules/css-functions-list": { "node_modules/css-functions-list": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.1.0.tgz", "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.1.0.tgz",
"url": "https://github.com/sponsors/fb55" "url": "https://github.com/sponsors/fb55"
} }
}, },
"node_modules/css-shorthand-properties": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/css-shorthand-properties/-/css-shorthand-properties-1.1.1.tgz",
"integrity": "sha512-Md+Juc7M3uOdbAFwOYlTrccIZ7oCFuzrhKYQjdeUEW/sE1hv17Jp/Bws+ReOPpGVBTYCBoYo+G17V5Qo8QQ75A==",
"dev": true
},
"node_modules/css-tree": { "node_modules/css-tree": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz",
"npm": ">=7.0.0" "npm": ">=7.0.0"
} }
}, },
"node_modules/css-values": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/css-values/-/css-values-0.1.0.tgz",
"integrity": "sha512-hQ6JSn4t/70aOCvdlP9zTOsFFUifMSKWz3PX7rz5NZl+uEHCqTFVJJvfP07isErCGEVHYoc8Orja8wLKZRvOeg==",
"dev": true,
"dependencies": {
"css-color-names": "0.0.4",
"ends-with": "^0.2.0",
"postcss-value-parser": "^3.3.0"
}
},
"node_modules/css-values/node_modules/postcss-value-parser": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
"integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
"dev": true
},
"node_modules/css-what": { "node_modules/css-what": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
"node": ">= 4" "node": ">= 4"
} }
}, },
"node_modules/ends-with": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/ends-with/-/ends-with-0.2.0.tgz",
"integrity": "sha512-lRppY4dK3VkqBdR242sKcAJeYc8Gf/DhoX9AWvWI2RzccmLnqBQfwm2k4oSDv5MPDjUqawCauXhZkyWxkVhRsg==",
"dev": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/enhanced-resolve": { "node_modules/enhanced-resolve": {
"version": "5.10.0", "version": "5.10.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz",
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/shortcss": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/shortcss/-/shortcss-0.1.3.tgz",
"integrity": "sha512-MIOoTd99CIGTrAuGiMUx9VZrnrZmWzEHuKbGM/w+ia/w98cezhlN9w4aQOVSxswdoqkUnWrMw3tThOi3sevZAg==",
"dev": true,
"dependencies": {
"css-shorthand-properties": "^1.0.0"
}
},
"node_modules/side-channel": { "node_modules/side-channel": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"stylelint": "^14.14.0" "stylelint": "^14.14.0"
} }
}, },
"node_modules/stylelint-declaration-strict-value": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/stylelint-declaration-strict-value/-/stylelint-declaration-strict-value-1.9.1.tgz",
"integrity": "sha512-iIkMh2ukIfSTtJoEDgGq5cqUyYWP8NExPk2YSGcePtFikb7KmJoSi0QYajiZRxge/PTbYspci7nIcrtArJlAsw==",
"dev": true,
"dependencies": {
"css-values": "^0.1.0",
"shortcss": "^0.1.3"
},
"peerDependencies": {
"stylelint": ">=7 <=14"
}
},
"node_modules/stylelint/node_modules/balanced-match": { "node_modules/stylelint/node_modules/balanced-match": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-2.0.0.tgz",
"which": "^2.0.1" "which": "^2.0.1"
} }
}, },
"css-color-names": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/css-color-names/-/css-color-names-0.0.4.tgz",
"integrity": "sha512-zj5D7X1U2h2zsXOAM8EyUREBnnts6H+Jm+d1M2DbiQQcUtnqgQsMrdo8JW9R80YFUmIdBZeMu5wvYM7hcgWP/Q==",
"dev": true
},
"css-functions-list": { "css-functions-list": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.1.0.tgz", "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.1.0.tgz",
"nth-check": "^2.0.1" "nth-check": "^2.0.1"
} }
}, },
"css-shorthand-properties": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/css-shorthand-properties/-/css-shorthand-properties-1.1.1.tgz",
"integrity": "sha512-Md+Juc7M3uOdbAFwOYlTrccIZ7oCFuzrhKYQjdeUEW/sE1hv17Jp/Bws+ReOPpGVBTYCBoYo+G17V5Qo8QQ75A==",
"dev": true
},
"css-tree": { "css-tree": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.2.1.tgz",
"source-map-js": "^1.0.1" "source-map-js": "^1.0.1"
} }
}, },
"css-values": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/css-values/-/css-values-0.1.0.tgz",
"integrity": "sha512-hQ6JSn4t/70aOCvdlP9zTOsFFUifMSKWz3PX7rz5NZl+uEHCqTFVJJvfP07isErCGEVHYoc8Orja8wLKZRvOeg==",
"dev": true,
"requires": {
"css-color-names": "0.0.4",
"ends-with": "^0.2.0",
"postcss-value-parser": "^3.3.0"
},
"dependencies": {
"postcss-value-parser": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz",
"integrity": "sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ==",
"dev": true
}
}
},
"css-what": { "css-what": {
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz",
"resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz",
"integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==" "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q=="
}, },
"ends-with": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/ends-with/-/ends-with-0.2.0.tgz",
"integrity": "sha512-lRppY4dK3VkqBdR242sKcAJeYc8Gf/DhoX9AWvWI2RzccmLnqBQfwm2k4oSDv5MPDjUqawCauXhZkyWxkVhRsg==",
"dev": true
},
"enhanced-resolve": { "enhanced-resolve": {
"version": "5.10.0", "version": "5.10.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz", "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-5.10.0.tgz",
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
}, },
"shortcss": {
"version": "0.1.3",
"resolved": "https://registry.npmjs.org/shortcss/-/shortcss-0.1.3.tgz",
"integrity": "sha512-MIOoTd99CIGTrAuGiMUx9VZrnrZmWzEHuKbGM/w+ia/w98cezhlN9w4aQOVSxswdoqkUnWrMw3tThOi3sevZAg==",
"dev": true,
"requires": {
"css-shorthand-properties": "^1.0.0"
}
},
"side-channel": { "side-channel": {
"version": "1.0.4", "version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
"stylelint-config-recommended": "^9.0.0" "stylelint-config-recommended": "^9.0.0"
} }
}, },
"stylelint-declaration-strict-value": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/stylelint-declaration-strict-value/-/stylelint-declaration-strict-value-1.9.1.tgz",
"integrity": "sha512-iIkMh2ukIfSTtJoEDgGq5cqUyYWP8NExPk2YSGcePtFikb7KmJoSi0QYajiZRxge/PTbYspci7nIcrtArJlAsw==",
"dev": true,
"requires": {
"css-values": "^0.1.0",
"shortcss": "^0.1.3"
}
},
"stylis": { "stylis": {
"version": "4.1.3", "version": "4.1.3",
"resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz", "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.1.3.tgz",

+ 1
- 0
package.json View File

"postcss-less": "6.0.0", "postcss-less": "6.0.0",
"stylelint": "14.15.0", "stylelint": "14.15.0",
"stylelint-config-standard": "29.0.0", "stylelint-config-standard": "29.0.0",
"stylelint-declaration-strict-value": "1.9.1",
"svgo": "3.0.2", "svgo": "3.0.2",
"updates": "13.2.1", "updates": "13.2.1",
"vitest": "0.25.2" "vitest": "0.25.2"

+ 19
- 8
web_src/less/_base.less View File

--color-info-border: #a9d5de; --color-info-border: #a9d5de;
--color-info-bg: #f8ffff; --color-info-bg: #f8ffff;
--color-info-text: #276f86; --color-info-text: #276f86;
--color-red-badge: #db2828;
--color-red-badge-bg: #db28281a;
--color-red-badge-hover-bg: #db28284d;
--color-green-badge: #21ba45;
--color-green-badge-bg: #21ba451a;
--color-green-badge-hover-bg: #21ba454d;
--color-yellow-badge: #fbbd08;
--color-yellow-badge-bg: #fbbd081a;
--color-yellow-badge-hover-bg: #fbbd084d;
--color-orange-badge: #f2711c;
--color-orange-badge-bg: #f2711c1a;
--color-orange-badge-hover-bg: #f2711c4d;
--color-git: #f05133;
/* target-based colors */
--color-body: #ffffff; --color-body: #ffffff;
--color-text-dark: #080808; --color-text-dark: #080808;
--color-text: #212121; --color-text: #212121;
} }


.searchbox { .searchbox {
background-color: #f4f4f4 !important;

&:focus {
background-color: #e9e9e9 !important;
}
background-color: var(--color-input-background) !important;
} }


.text .svg { .text .svg {
} }


.archived-icon { .archived-icon {
color: lighten(#000000, 70%) !important;
color: var(--color-secondary-dark-2) !important;
} }


.oauth2-authorize-application-box { .oauth2-authorize-application-box {
.lines-commit { .lines-commit {
&:extend(.unselectable); &:extend(.unselectable);
vertical-align: top; vertical-align: top;
color: #999999;
color: var(--color-grey);
padding: 0 !important; padding: 0 !important;
background: var(--color-code-sidebar-bg); background: var(--color-code-sidebar-bg);
width: 1%; width: 1%;
color: var(--color-text); color: var(--color-text);
} }


.ui.active.button,
.ui.button:active, .ui.button:active,
.ui.active.button:active, .ui.active.button:active,
.ui.active.button:hover { .ui.active.button:hover {
} }


.migrate .svg.gitea-git { .migrate .svg.gitea-git {
color: #f05133; /* from https://upload.wikimedia.org/wikipedia/commons/e/e0/Git-logo.svg */
color: var(--color-git);
} }


.color-icon { .color-icon {

+ 1
- 1
web_src/less/_dashboard.less View File

} }


#privateFilterCheckbox .svg { #privateFilterCheckbox .svg {
color: #888888;
color: var(--color-grey);
margin-right: .25rem; margin-right: .25rem;
} }



+ 1
- 1
web_src/less/_install.less View File

.reinstall-message { .reinstall-message {
width: 70%; width: 70%;
margin: 20px auto; margin: 20px auto;
color: red;
color: var(--color-red);
text-align: left; text-align: left;
font-weight: bold; font-weight: bold;
} }

+ 33
- 33
web_src/less/_repository.less View File

position: absolute; position: absolute;
top: 9px; top: 9px;
left: 10px; left: 10px;
color: #b0c4ce;
color: var(--color-grey);
} }
} }
} }
border: 1px solid var(--color-light-border); border: 1px solid var(--color-light-border);


&.isSigned.isWarning { &.isSigned.isWarning {
border: 1px solid #db2828;
background: fade(#db2828, 10%);
border: 1px solid var(--color-red-badge);
background: var(--color-red-badge-bg);


.shortsha { .shortsha {
display: inline-block; display: inline-block;
} }


&:hover { &:hover {
background: fade(#db2828, 30%) !important;
background: var(--color-red-badge-hover-bg) !important;
} }
} }


&.isSigned.isVerified { &.isSigned.isVerified {
border: 1px solid #21ba45;
background: fade(#21ba45, 10%);
border: 1px solid var(--color-green-badge);
background: var(--color-green-badge-bg);


.shortsha { .shortsha {
display: inline-block; display: inline-block;
} }


&:hover { &:hover {
background: fade(#21ba45, 30%) !important;
background: var(--color-green-badge-hover-bg) !important;
} }
} }


&.isSigned.isVerifiedUntrusted { &.isSigned.isVerifiedUntrusted {
border: 1px solid #fbbd08;
background: fade(#fbbd08, 10%);
border: 1px solid var(--color-yellow-badge);
background: var(--color-yellow-badge-bg);


.shortsha { .shortsha {
display: inline-block; display: inline-block;
} }


&:hover { &:hover {
background: fade(#fbbd08, 30%) !important;
background: var(--color-yellow-badge-hover-bg) !important;
} }
} }


&.isSigned.isVerifiedUnmatched { &.isSigned.isVerifiedUnmatched {
border: 1px solid #f2711c;
background: fade(#f2711c, 10%);
border: 1px solid var(--color-orange-badge);
background: var(--color-orange-badge-bg);


.shortsha { .shortsha {
display: inline-block; display: inline-block;
} }


&:hover { &:hover {
background: fade(#f2711c, 30%) !important;
background: var(--color-orange-badge-hover-bg) !important;
} }
} }
} }
} }


&.isSigned.isWarning { &.isSigned.isWarning {
border: 1px solid #db2828;
background: fade(#db2828, 10%);
border: 1px solid var(--color-red-badge);
background: var(--color-red-badge-bg);


.shortsha { .shortsha {
display: inline-block; display: inline-block;
} }


.detail.icon { .detail.icon {
border-left: 1px solid #db2828;
color: #db2828;
border-left: 1px solid var(--color-red-badge);
color: var(--color-red-badge);
} }


&:hover { &:hover {
background: fade(#db2828, 30%) !important;
background: var(--color-red-badge-hover-bg) !important;
} }
} }


&.isSigned.isVerified { &.isSigned.isVerified {
border: 1px solid #21ba45;
background: fade(#21ba45, 10%);
border: 1px solid var(--color-green-badge);
background: var(--color-green-badge-bg);


.shortsha { .shortsha {
display: inline-block; display: inline-block;
} }


.detail.icon { .detail.icon {
border-left: 1px solid #21ba45;
color: #21ba45;
border-left: 1px solid var(--color-green-badge);
color: var(--color-green-badge);
} }


&:hover { &:hover {
background: fade(#21ba45, 30%) !important;
background: var(--color-green-badge-hover-bg) !important;
} }
} }


&.isSigned.isVerifiedUntrusted { &.isSigned.isVerifiedUntrusted {
border: 1px solid #fbbd08;
background: fade(#fbbd08, 10%);
border: 1px solid var(--color-yellow-badge);
background: var(--color-yellow-badge-bg);


.shortsha { .shortsha {
display: inline-block; display: inline-block;
} }


.detail.icon { .detail.icon {
border-left: 1px solid #fbbd08;
color: #fbbd08;
border-left: 1px solid var(--color-yellow-badge);
color: var(--color-yellow-badge);
} }


&:hover { &:hover {
background: fade(#fbbd08, 30%) !important;
background: var(--color-yellow-badge-hover-bg) !important;
} }
} }


&.isSigned.isVerifiedUnmatched { &.isSigned.isVerifiedUnmatched {
border: 1px solid #f2711c;
background: fade(#f2711c, 10%);
border: 1px solid var(--color-orange-badge);
background: var(--color-orange-badge-bg);


.shortsha { .shortsha {
display: inline-block; display: inline-block;
} }


.detail.icon { .detail.icon {
border-left: 1px solid #f2711c;
color: #f2711c;
border-left: 1px solid var(--color-orange-badge);
color: var(--color-orange-badge);
} }


&:hover { &:hover {
background: fade(#f2711c, 30%) !important;
background: var(--color-orange-badge-hover-bg) !important;
} }
} }
} }

+ 13
- 0
web_src/less/themes/theme-arc-green.less View File

--color-info-border: #306090; --color-info-border: #306090;
--color-info-bg: #26354c; --color-info-bg: #26354c;
--color-info-text: #38a8e8; --color-info-text: #38a8e8;
--color-red-badge: #db2828;
--color-red-badge-bg: #db28281a;
--color-red-badge-hover-bg: #db28284d;
--color-green-badge: #21ba45;
--color-green-badge-bg: #21ba451a;
--color-green-badge-hover-bg: #21ba454d;
--color-yellow-badge: #fbbd08;
--color-yellow-badge-bg: #fbbd081a;
--color-yellow-badge-hover-bg: #fbbd084d;
--color-orange-badge: #f2711c;
--color-orange-badge-bg: #f2711c1a;
--color-orange-badge-hover-bg: #f2711c4d;
--color-git: #f05133;
/* target-based colors */ /* target-based colors */
--color-body: #383c4a; --color-body: #383c4a;
--color-box-header: #404652; --color-box-header: #404652;

Loading…
Cancel
Save