Skip to content

Commit e662907

Browse files
authored
Starting separate CSS color definitions. (#8048)
1 parent b4e2bed commit e662907

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

pkg/web_css/lib/src/_base.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ p {
3232
}
3333

3434
p.warning {
35-
border-left: 0.25em solid $color-input-danger;
35+
border-left: 0.25em solid var(--pub-color-dangerRed);
3636
padding-left: 10px;
3737
}
3838

@@ -77,8 +77,7 @@ button {
7777
border: none;
7878

7979
&.pub-button-danger {
80-
// TODO: figure out why we can't use $color-input-danger here
81-
--mdc-theme-primary: #ff4242;
80+
--mdc-theme-primary: var(--pub-color-dangerRed);
8281
}
8382

8483
&.pub-button-cancel {

pkg/web_css/lib/src/_variables.scss

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1-
// suggested naming convention: `--pub-[component]-[role]-[property]`, where
2-
// - `[component]` may be: `default`, `button`, `link`, `card`, ...
3-
// - `[role]` may be the `background`, `text`, `border`, ... (multiple parts are separated by `_`)
4-
// - `[property]` may be `color`, `opacity` for specific values, or a `value` for multi-part properties.
1+
// suggested naming convention:
2+
//
3+
// color definitions:
4+
// `--pub-color-<qualifier><baseColor>`
5+
//
6+
// components:
7+
// `--pub-[component]-[role]-[property]`, where
8+
// - `[component]` may be: `default`, `button`, `link`, `card`, ...
9+
// - `[role]` may be the `background`, `text`, `border`, ... (multiple parts are separated by `_`)
10+
// - `[property]` may be `color`, `opacity` for specific values, or a `value` for multi-part properties.
511

612
:root {
13+
--pub-color-dangerRed: #ff4242;
14+
715
--pub-default-background-color: #ffffff;
816
--pub-default-headline-font_family: "Google Sans Display", "Google Sans", "Roboto", sans-serif;
917
--pub-default-text-color: hsl(0, 0%, 29%);
@@ -13,7 +21,7 @@
1321
--pub-link-text-color: #0175c2;
1422
--pub-code-text-font_family: "Google Sans Mono", "Roboto Mono", "Source Code Pro", Menlo, "Bitstream Vera Sans Mono", "DejaVu Sans Mono", Monaco, Consolas, monospace;
1523
--pub-badge-default-color: var(--pub-link-text-color);
16-
--pub-badge-red-color: #ff4242;
24+
--pub-badge-red-color: var(--pub-color-dangerRed);
1725
--pub-carousel-background-color: rgba(0,0,0,0.85);
1826
--pub-carousel_nav-background-color: rgba(0,0,0,0.7);
1927
--pub-carousel_nav_hover-background-color: #4285f4;
@@ -47,7 +55,7 @@
4755
--pub-input-placeholder-color: #888;
4856
--pub-pkg_list_item_hover-background-color: #fafafa;
4957
--pub-pkg_list_recent_item-text-color: #6d7278;
50-
--pub-remove_button-background-color: #ff4242;
58+
--pub-remove_button-background-color: var(--pub-color-dangerRed);
5159
--pub-remove_button-text-color: #ffffff;
5260
--pub-report_header_score_error-text-color: #e13701;
5361
--pub-report_header_score_warning-text-color: #ffa500;
@@ -102,7 +110,7 @@
102110
--pub-code-text-color: var(--pub-default-text-color);
103111
--pub-link-text-color: #40c4ff;
104112
--pub-badge-default-color: var(--pub-link-text-color);
105-
--pub-badge-red-color: #ff4242;
113+
--pub-badge-red-color: var(--pub-color-dangerRed);
106114
--pub-copy_feedback-background-color: #404040;
107115
--pub-detail_tab-background-color: var(--pub-code-background-color);
108116
--pub-detail_tab-text-color: var(--pub-default-text-color);
@@ -195,7 +203,5 @@ $z-index-nav-mask: 1000;
195203

196204
$site-max-width: 1136px;
197205

198-
$color-input-danger: #ff4242;
199-
200206
// NOTE: keep in sync with hoverable.dart 900ms delay
201207
$copy-feedback-transition-opacity-delay: 0.9s;

0 commit comments

Comments
 (0)