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 6 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
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
$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;

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

$medium: 400;
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
10 changes: 9 additions & 1 deletion packages/@ourworldindata/components/src/styles/colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ $amber-10: #f4eddb;
$blue-20: #dbe5f0;
$blue-10: #ebeef2;
$blue-5: #f0f4fa;
$gray-10: #f7f7f7;
$gray-90: #4e4e4e;
$gray-80: #5b5b5b;
$gray-70: #858585;
$gray-60: #a1a1a1;
$gray-50: #c6c6c6;
$gray-30: #dadada;
$gray-20: #e7e7e7;
$gray-10: #f2f2f2;
$gray-5: #f7f7f7;
$beige: #fbf9f3;
$white: #ffffff;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
$hover-fill: #f2f2f2;
$active-fill: #dbe5f0;

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

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

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

&.custom-icon {
--size: $icon-width;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ $active-fill: #dbe5f0;
$hover-fill: #f2f2f2;
$selected-fill: #c7ced7;

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

$medium: 400;
Expand Down
2 changes: 0 additions & 2 deletions packages/@ourworldindata/grapher/src/controls/Dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
$hover-fill: #f2f2f2;
$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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ $active-fill: #dbe5f0;
$hover-fill: #f2f2f2;
$selected-fill: #c7ced7;

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

$medium: 400;
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
24 changes: 12 additions & 12 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 @@ -178,10 +178,10 @@ $zindex-controls-drawer: 150;
.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-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
10 changes: 3 additions & 7 deletions packages/@ourworldindata/grapher/src/dataTable/DataTable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
$hover-fill: #f0f0f0;
$dark-fill: #e7e7e7;

// sort icon
$sort-icon: #c6c6c6;
$hover-icon: #a1a1a1;

// closest time notice
$info-icon: #dadada;

Expand Down Expand Up @@ -133,7 +129,7 @@
text-align: left;

.description {
color: #a1a1a1;
color: $gray-60;
text-align: left;
}
}
Expand All @@ -159,7 +155,7 @@
}

.sort-icon {
color: $sort-icon;
color: $gray-50;
font-size: 13px;
width: 19px; // keeps column widths fixed when sorting
text-align: right;
Expand All @@ -170,7 +166,7 @@
}

&:hover .sort-icon {
color: $hover-icon;
color: $gray-60;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$svg-margin: 8px;
$svg-size: 12px;

$placeholder: #a1a1a1;
$placeholder: $gray-60;
$focus: 1px solid #a4b6ca;

position: relative;
Expand Down Expand Up @@ -155,7 +155,7 @@

&:disabled {
background: #f2f2f2;
color: #a1a1a1;
color: $gray-60;
}
}
}
Expand Down Expand Up @@ -194,7 +194,7 @@
}

.value {
color: #a1a1a1;
color: $gray-60;
white-space: nowrap;
margin-left: 12px;
}
Expand All @@ -216,7 +216,7 @@
svg {
margin-left: 6px;
font-size: 0.9em;
color: #a1a1a1;
color: $gray-60;

// hide focus outline when clicked
&:focus:not(:focus-visible) {
Expand Down Expand Up @@ -298,7 +298,7 @@
}

&:disabled {
color: #c6c6c6;
color: $gray-50;
text-decoration: none;
cursor: default;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ $timelineHeight: 32px;
$light-timeline: #e7e7e7;
$active-timeline: #a4b6ca;

// start/end handle
$light-knob: #a1a1a1;
// end handle
$active-knob: #6e87a2;

// start/end year label
Expand Down Expand Up @@ -79,7 +78,7 @@ $timelineHeight: 32px;
width: $handle-diameter;
border-radius: 100%;

background: $light-knob;
background: $gray-60;
border: 2px solid #fff;
z-index: 1;
pointer-events: none;
Expand Down
2 changes: 1 addition & 1 deletion packages/@ourworldindata/grapher/src/tooltip/Tooltip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

.variable {
.definition {
color: #858585;
color: $gray-70;
font-size: 12px;
line-height: 15px;
letter-spacing: 0.01em;
Expand Down
2 changes: 1 addition & 1 deletion site/css/content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ figure[data-explorer-src] {
border: 1px solid #e7e7e7;
border-radius: 4px;
padding: 5px 7px;
color: #5b5b5b;
color: $gray-80;
white-space: nowrap;
margin: -5px 0px -5px -2px;

Expand Down