Change button colors to increase hover/focus contrast and consistency (#25677)

pull/2272/head
Trevor Wolf 2023-07-03 19:32:31 +10:00 committed by GitHub
parent e6a8faae81
commit 54cb679c19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 96 deletions

View File

@ -5,19 +5,6 @@ html {
scrollbar-color: $ui-base-color rgba($ui-base-color, 0.25); scrollbar-color: $ui-base-color rgba($ui-base-color, 0.25);
} }
// Change the colors of button texts
.button {
color: $white;
&.button-alternative-2 {
color: $white;
}
&.button-tertiary {
color: $highlight-text-color;
}
}
.simple_form .button.button-tertiary { .simple_form .button.button-tertiary {
color: $highlight-text-color; color: $highlight-text-color;
} }
@ -436,26 +423,6 @@ html {
color: $white; color: $white;
} }
.button.button-tertiary {
&:hover,
&:focus,
&:active {
color: $white;
}
}
.button.button-secondary {
border-color: $darker-text-color;
color: $darker-text-color;
&:hover,
&:focus,
&:active {
border-color: darken($darker-text-color, 8%);
color: darken($darker-text-color, 8%);
}
}
.flash-message.warning { .flash-message.warning {
color: lighten($gold-star, 16%); color: lighten($gold-star, 16%);
} }

View File

@ -7,6 +7,12 @@ $classic-primary-color: #9baec8;
$classic-secondary-color: #d9e1e8; $classic-secondary-color: #d9e1e8;
$classic-highlight-color: #6364ff; $classic-highlight-color: #6364ff;
$blurple-600: #563acc; // Iris
$blurple-500: #6364ff; // Brand purple
$blurple-300: #858afa; // Faded Blue
$grey-600: #4e4c5a; // Trout
$grey-100: #dadaf3; // Topaz
// Differences // Differences
$success-green: lighten(#3c754d, 8%); $success-green: lighten(#3c754d, 8%);
@ -19,6 +25,13 @@ $ui-primary-color: #9bcbed;
$ui-secondary-color: $classic-base-color !default; $ui-secondary-color: $classic-base-color !default;
$ui-highlight-color: $classic-highlight-color !default; $ui-highlight-color: $classic-highlight-color !default;
$ui-button-secondary-color: $grey-600 !default;
$ui-button-secondary-border-color: $grey-600 !default;
$ui-button-secondary-focus-color: $white !default;
$ui-button-tertiary-color: $blurple-500 !default;
$ui-button-tertiary-border-color: $blurple-500 !default;
$primary-text-color: $black !default; $primary-text-color: $black !default;
$darker-text-color: $classic-base-color !default; $darker-text-color: $classic-base-color !default;
$highlight-text-color: darken($ui-highlight-color, 8%) !default; $highlight-text-color: darken($ui-highlight-color, 8%) !default;

View File

@ -128,7 +128,6 @@ $content-width: 840px;
} }
&.selected { &.selected {
background: darken($ui-base-color, 2%);
border-radius: 4px 0 0; border-radius: 4px 0 0;
} }
} }
@ -146,13 +145,9 @@ $content-width: 840px;
.simple-navigation-active-leaf a { .simple-navigation-active-leaf a {
color: $primary-text-color; color: $primary-text-color;
background-color: darken($ui-highlight-color, 2%); background-color: $ui-highlight-color;
border-bottom: 0; border-bottom: 0;
border-radius: 0; border-radius: 0;
&:hover {
background-color: $ui-highlight-color;
}
} }
} }
@ -246,12 +241,6 @@ $content-width: 840px;
font-weight: 700; font-weight: 700;
color: $primary-text-color; color: $primary-text-color;
background: $ui-highlight-color; background: $ui-highlight-color;
&:hover,
&:focus,
&:active {
background: lighten($ui-highlight-color, 4%);
}
} }
} }
} }

View File

@ -47,11 +47,11 @@
} }
.button { .button {
background-color: darken($ui-highlight-color, 2%); background-color: $ui-button-background-color;
border: 10px none; border: 10px none;
border-radius: 4px; border-radius: 4px;
box-sizing: border-box; box-sizing: border-box;
color: $primary-text-color; color: $ui-button-color;
cursor: pointer; cursor: pointer;
display: inline-block; display: inline-block;
font-family: inherit; font-family: inherit;
@ -71,14 +71,14 @@
&:active, &:active,
&:focus, &:focus,
&:hover { &:hover {
background-color: $ui-highlight-color; background-color: $ui-button-focus-background-color;
} }
&--destructive { &--destructive {
&:active, &:active,
&:focus, &:focus,
&:hover { &:hover {
background-color: $error-red; background-color: $ui-button-destructive-focus-background-color;
transition: none; transition: none;
} }
} }
@ -108,39 +108,18 @@
outline: 0 !important; outline: 0 !important;
} }
&.button-alternative {
color: $inverted-text-color;
background: $ui-primary-color;
&:active,
&:focus,
&:hover {
background-color: lighten($ui-primary-color, 4%);
}
}
&.button-alternative-2 {
background: $ui-base-lighter-color;
&:active,
&:focus,
&:hover {
background-color: lighten($ui-base-lighter-color, 4%);
}
}
&.button-secondary { &.button-secondary {
color: $darker-text-color; color: $ui-button-secondary-color;
background: transparent; background: transparent;
padding: 6px 17px; padding: 6px 17px;
border: 1px solid lighten($ui-base-color, 12%); border: 1px solid $ui-button-secondary-border-color;
&:active, &:active,
&:focus, &:focus,
&:hover { &:hover {
background: lighten($ui-base-color, 4%); border-color: $ui-button-secondary-focus-background-color;
border-color: lighten($ui-base-color, 16%); color: $ui-button-secondary-focus-color;
color: lighten($darker-text-color, 4%); background-color: $ui-button-secondary-focus-background-color;
text-decoration: none; text-decoration: none;
} }
@ -152,14 +131,14 @@
&.button-tertiary { &.button-tertiary {
background: transparent; background: transparent;
padding: 6px 17px; padding: 6px 17px;
color: $highlight-text-color; color: $ui-button-tertiary-color;
border: 1px solid $highlight-text-color; border: 1px solid $ui-button-tertiary-border-color;
&:active, &:active,
&:focus, &:focus,
&:hover { &:hover {
background: $ui-highlight-color; background-color: $ui-button-tertiary-focus-background-color;
color: $primary-text-color; color: $ui-button-tertiary-focus-color;
border: 0; border: 0;
padding: 7px 18px; padding: 7px 18px;
} }
@ -5810,15 +5789,15 @@ a.status-card.compact:hover {
} }
.button.button-secondary { .button.button-secondary {
border-color: $inverted-text-color; border-color: $ui-button-secondary-border-color;
color: $inverted-text-color; color: $ui-button-secondary-color;
flex: 0 0 auto; flex: 0 0 auto;
&:hover, &:hover,
&:focus, &:focus,
&:active { &:active {
border-color: lighten($inverted-text-color, 15%); border-color: $ui-button-secondary-focus-background-color;
color: lighten($inverted-text-color, 15%); color: $ui-button-secondary-focus-color;
} }
} }

View File

@ -81,7 +81,7 @@
display: flex; display: flex;
align-items: baseline; align-items: baseline;
border-radius: 4px; border-radius: 4px;
background: darken($ui-highlight-color, 2%); background: $ui-button-background-color;
color: $primary-text-color; color: $primary-text-color;
transition: all 100ms ease-in; transition: all 100ms ease-in;
font-size: 14px; font-size: 14px;
@ -94,7 +94,7 @@
&:active, &:active,
&:focus, &:focus,
&:hover { &:hover {
background-color: $ui-highlight-color; background-color: $ui-button-focus-background-color;
transition: all 200ms ease-out; transition: all 200ms ease-out;
} }

View File

@ -511,8 +511,8 @@ code {
width: 100%; width: 100%;
border: 0; border: 0;
border-radius: 4px; border-radius: 4px;
background: darken($ui-highlight-color, 2%); background: $ui-button-background-color;
color: $primary-text-color; color: $ui-button-color;
font-size: 18px; font-size: 18px;
line-height: inherit; line-height: inherit;
height: auto; height: auto;
@ -534,7 +534,7 @@ code {
&:active, &:active,
&:focus, &:focus,
&:hover { &:hover {
background-color: $ui-highlight-color; background-color: $ui-button-focus-background-color;
} }
&:disabled:hover { &:disabled:hover {
@ -542,15 +542,12 @@ code {
} }
&.negative { &.negative {
background: $error-value-color; background: $ui-button-destructive-background-color;
&:hover {
background-color: lighten($error-value-color, 5%);
}
&:hover,
&:active, &:active,
&:focus { &:focus {
background-color: darken($error-value-color, 5%); background-color: $ui-button-destructive-focus-background-color;
} }
} }
} }

View File

@ -1,8 +1,16 @@
// Commonly used web colors // Commonly used web colors
$black: #000000; // Black $black: #000000; // Black
$white: #ffffff; // White $white: #ffffff; // White
$red-600: #b7253d !default; // Deep Carmine
$red-500: #df405a !default; // Cerise
$blurple-600: #563acc; // Iris
$blurple-500: #6364ff; // Brand purple
$blurple-300: #858afa; // Faded Blue
$grey-600: #4e4c5a; // Trout
$grey-100: #dadaf3; // Topaz
$success-green: #79bd9a !default; // Padua $success-green: #79bd9a !default; // Padua
$error-red: #df405a !default; // Cerise $error-red: $red-500 !default; // Cerise
$warning-red: #ff5050 !default; // Sunset Orange $warning-red: #ff5050 !default; // Sunset Orange
$gold-star: #ca8f04 !default; // Dark Goldenrod $gold-star: #ca8f04 !default; // Dark Goldenrod
@ -31,6 +39,22 @@ $ui-base-lighter-color: lighten(
$ui-primary-color: $classic-primary-color !default; // Lighter $ui-primary-color: $classic-primary-color !default; // Lighter
$ui-secondary-color: $classic-secondary-color !default; // Lightest $ui-secondary-color: $classic-secondary-color !default; // Lightest
$ui-highlight-color: $classic-highlight-color !default; $ui-highlight-color: $classic-highlight-color !default;
$ui-button-color: $white !default;
$ui-button-background-color: $blurple-500 !default;
$ui-button-focus-background-color: $blurple-600 !default;
$ui-button-secondary-color: $grey-100 !default;
$ui-button-secondary-border-color: $grey-100 !default;
$ui-button-secondary-focus-background-color: $grey-600 !default;
$ui-button-secondary-focus-color: $white !default;
$ui-button-tertiary-color: $blurple-300 !default;
$ui-button-tertiary-border-color: $blurple-300 !default;
$ui-button-tertiary-focus-background-color: $blurple-600 !default;
$ui-button-tertiary-focus-color: $white !default;
$ui-button-destructive-background-color: $red-500 !default;
$ui-button-destructive-focus-background-color: $red-600 !default;
// Variables for texts // Variables for texts
$primary-text-color: $white !default; $primary-text-color: $white !default;
@ -38,7 +62,8 @@ $darker-text-color: $ui-primary-color !default;
$dark-text-color: $ui-base-lighter-color !default; $dark-text-color: $ui-base-lighter-color !default;
$secondary-text-color: $ui-secondary-color !default; $secondary-text-color: $ui-secondary-color !default;
$highlight-text-color: lighten($ui-highlight-color, 8%) !default; $highlight-text-color: lighten($ui-highlight-color, 8%) !default;
$action-button-color: $ui-base-lighter-color !default; $action-button-color: $ui-base-color !default;
$action-button-focus-color: $ui-base-color !default;
$passive-text-color: $gold-star !default; $passive-text-color: $gold-star !default;
$active-passive-text-color: $success-green !default; $active-passive-text-color: $success-green !default;