Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: add more background gray colors #3855

Merged
merged 8 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/@ourworldindata/components/src/Checkbox.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
.checkbox {
$checkbox-size: 16px;

$light-stroke: #dadada;
$hover-stroke: #a4b6ca;
$active-fill: #a4b6ca;
$light-stroke: $gray-30;
$hover-stroke: $blue-30;
$active-fill: $blue-30;

position: relative;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
$dark-text: #5b5b5b;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can revert these "convention changes" I made by swapping out the top level definitions for inline usage of the global variables if you'd prefer, Marcel.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I've done more of these now :)

Overall, I find it nice sometimes that colors are given a more meaningful name with local SCSS variables inside a component. I don't mind that, but I do mind using hex codes when color names are available and make more sense.

$light-text: #858585;
$light-fill: #dadada;
$active-fill: #dbe5f0;
$light-fill: $gray-30;
$active-fill: $blue-20;

$info-icon: #a1a1a1;
$active-switch: #6e87a2;
$active-switch: $blue-50;

$medium: 400;
$lato: $sans-serif-font-stack;
Expand All @@ -15,7 +12,7 @@ $lato: $sans-serif-font-stack;
// where the width of a labeled switch is calculated

display: flex;
color: $light-text;
color: $gray-70;
font: $medium 13px/16px $lato;
letter-spacing: 0.01em;

Expand All @@ -25,7 +22,7 @@ $lato: $sans-serif-font-stack;
user-select: none;

label {
color: $dark-text;
color: $gray-80;
padding-left: 35px;
white-space: nowrap;

Expand All @@ -34,7 +31,7 @@ $lato: $sans-serif-font-stack;
}

svg {
color: $info-icon;
color: $gray-60;
height: 13px;
padding: 0 0.333em;
}
Expand Down Expand Up @@ -66,7 +63,7 @@ $lato: $sans-serif-font-stack;
content: " ";
width: 10px;
height: 10px;
background: $light-text;
background: $gray-70;
border-radius: 5px;
top: 3px;
left: 3px;
Expand All @@ -77,7 +74,7 @@ $lato: $sans-serif-font-stack;

&:hover {
.outer .inner {
background: $dark-text;
background: $gray-80;
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/@ourworldindata/components/src/RadioButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
.radio {
$radio-size: 16px;

$light-stroke: #a4b6ca;
$active-fill: #6e87a2;
$light-stroke: $blue-30;
$active-fill: $blue-50;

position: relative;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
// keep in sync with CLOSE_BUTTON_SIZE in CloseButton.tsx
$size: 32px;

$light-stroke: #e7e7e7;
$light-stroke: $gray-20;

$active-fill: #dbe5f0;
$hover-fill: #f2f2f2;
$hover-fill: $gray-10;

display: flex;
align-items: center;
Expand Down
16 changes: 14 additions & 2 deletions packages/@ourworldindata/components/src/styles/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,27 @@ $blue-50: #6e87a2;
$blue-40: #98a9bd;
$blue-30: #a4b6ca;

/* Amber shades */
// Gray shades
$gray-90: #4e4e4e;
$gray-80: #5b5b5b;
$gray-70: #858585;
$gray-60: #a1a1a1;
$gray-50: #c6c6c6;

// Amber shades
$amber-110: #f9cf44;
$amber-10: #f4eddb;

// Background colors
$blue-20: #dbe5f0;
$blue-10: #ebeef2;
$blue-5: #f0f4fa;
$gray-10: #f7f7f7;

$gray-30: #dadada;
$gray-20: #e7e7e7;
$gray-10: #f2f2f2;
$gray-5: #f7f7f7;

$beige: #fbf9f3;
$white: #ffffff;

Expand Down
2 changes: 1 addition & 1 deletion packages/@ourworldindata/components/src/styles/mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
color: #333;

.header {
background: #002147;
background: $oxford-blue;
color: white;
font-size: 1rem;
font-weight: 700;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ $paddingX: 12px; // keep in sync with PADDING_X
}

.ActionButton {
$light-fill: #f2f2f2;
$hover-fill: #e7e7e7;
$active-fill: #dbe5f0;
$light-fill: $gray-10;
$hover-fill: $gray-20;
$active-fill: $blue-20;

height: 100%;
border-radius: 4px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
$icon-padding: 6px;
--outer-padding: 16px;

$light-stroke: #e7e7e7;
$light-stroke: $gray-20;

$hover-fill: #f2f2f2;
$active-fill: #dbe5f0;
$hover-fill: $gray-10;
$active-fill: $blue-20;

$info-icon: #a1a1a1;
$active-icon: #6e87a2;
$active-icon: $blue-50;

$border-radius: 4px;
$visual-gap: 2px;
Expand Down Expand Up @@ -57,7 +56,7 @@
}

svg {
color: $info-icon;
color: $gray-60;

&.custom-icon {
--size: $icon-width;
Expand Down
13 changes: 6 additions & 7 deletions packages/@ourworldindata/grapher/src/controls/Controls.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
$light-stroke: #e7e7e7;
$light-stroke: $gray-20;
$dark-stroke: #2d2d2d;
$active-stroke: #a4b6ca;
$active-stroke: $blue-30;

$light-fill: #dadada;
$active-fill: #dbe5f0;
$hover-fill: #f2f2f2;
$light-fill: $gray-30;
$active-fill: $blue-20;
$hover-fill: $gray-10;
$selected-fill: #c7ced7;

$info-icon: #a1a1a1;
$active-switch: #6e87a2;
$active-switch: $blue-50;

$medium: 400;
$bold: 700;
Expand Down
12 changes: 5 additions & 7 deletions packages/@ourworldindata/grapher/src/controls/Dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
$medium: 400;
$lato: $sans-serif-font-stack;

$light-stroke: #e7e7e7;
$active-stroke: #a4b6ca;
$light-stroke: $gray-20;
$active-stroke: $blue-30;

$active-fill: #dbe5f0;
$hover-fill: #f2f2f2;
$active-fill: $blue-20;
$hover-fill: $gray-10;
$selected-fill: #c7ced7;

$light-text: #858585;

font: $medium 13px/16px $lato;

// fixes a bug in Firefox where long labels would cause the dropdown to resize,
Expand All @@ -34,7 +32,7 @@
color: $dark-text;

&.focus {
outline: 1px solid #a4b6ca !important;
outline: 1px solid $blue-30 !important;
outline-offset: -1px;
}

Expand Down
17 changes: 8 additions & 9 deletions packages/@ourworldindata/grapher/src/controls/SettingsMenu.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
$light-stroke: #e7e7e7;
$light-stroke: $gray-20;
$dark-stroke: #2d2d2d;
$active-stroke: #a4b6ca;
$active-stroke: $blue-30;

$light-fill: #dadada;
$active-fill: #dbe5f0;
$hover-fill: #f2f2f2;
$light-fill: $gray-30;
$active-fill: $blue-20;
$hover-fill: $gray-10;
$selected-fill: #c7ced7;

$info-icon: #a1a1a1;
$active-switch: #6e87a2;
$active-switch: $blue-50;

$medium: 400;
$bold: 700;
Expand Down Expand Up @@ -105,7 +104,7 @@ nav.controlsRow .chart-controls .settings-menu {
list-style: none;

svg {
color: $info-icon;
color: $gray-60;
height: 13px;
padding: 0 0.333em;
}
Expand Down Expand Up @@ -190,7 +189,7 @@ nav.controlsRow .chart-controls .settings-menu {
}

&.active span {
background: #a4b6ca;
background: $blue-30;
}

&:hover:not(.active) span {
Expand Down
4 changes: 2 additions & 2 deletions packages/@ourworldindata/grapher/src/controls/ShareMenu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ $zindex-ControlsFooter: 2;
}

.ShareMenu {
$hover-fill: #f2f2f2;
$active-fill: #dbe5f0;
$hover-fill: $gray-10;
$active-fill: $blue-20;

position: absolute;
bottom: $timelineHeight + 8px;
Expand Down
28 changes: 14 additions & 14 deletions packages/@ourworldindata/grapher/src/core/grapher.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
@import "./typography.scss";

// grapher frame
$frame-color: #f2f2f2;
$frame-color: $gray-10;

// text
$dark-text: #5b5b5b;
$light-text: #858585;
$dark-text: $gray-80;
$light-text: $gray-70;
$active-text: $blue-90;

// tooltip for button label
$tooltip-fill: #4e4e4e;
$tooltip-fill: $gray-90;
$tooltip-text: #fff;

// These should be between 0–100 in order to avoid conflicting with
Expand Down Expand Up @@ -92,11 +92,11 @@ $zindex-controls-drawer: 150;
@import "../../../components/src/OverlayHeader.scss";

.grapher_dark {
color: $dark-text;
color: $gray-80;
}

.grapher_light {
color: $light-text;
color: $gray-70;
}

.GrapherComponent,
Expand All @@ -114,7 +114,7 @@ $zindex-controls-drawer: 150;
line-height: 1em;

background: white;
color: $dark-text;
color: $gray-80;

position: relative;
container-type: size;
Expand Down Expand Up @@ -176,12 +176,12 @@ $zindex-controls-drawer: 150;

// customize css of the <CodeSnippet> component
.wp-code-snippet {
--code-snippet-border: #e7e7e7;
--code-snippet-background-light: #f7f7f7;
--code-snippet-text: #{$light-text};
--code-snippet-button: #{$dark-text};
--code-snippet-button-hover: #{$light-text};
--code-snippet-button-active: #{$light-text};
--code-snippet-border: #{$gray-20};
--code-snippet-background-light: #{$gray-5};
--code-snippet-text: #{$gray-70};
--code-snippet-button: #{$gray-80};
--code-snippet-button-hover: #{$gray-70};
--code-snippet-button-active: #{$gray-70};

margin-bottom: 0 !important;
}
Expand Down Expand Up @@ -210,7 +210,7 @@ $zindex-controls-drawer: 150;
.tippy-box[data-theme="grapher-explanation"],
.tippy-box[data-theme="grapher-explanation--short"] {
background: white;
color: $dark-text;
color: $gray-80;
font: 400 14px/1.5 $sans-serif-font-stack;
box-shadow: 0px 4px 40px 0px rgba(0, 0, 0, 0.15);

Expand Down
Loading