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

Color update #698

Closed
wants to merge 3 commits into from
Closed
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
5 changes: 5 additions & 0 deletions .changeset/slow-bikes-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@microsoft/atlas-css': minor
---

Update badge, button, control, form, notification, progress bar colors.
38 changes: 25 additions & 13 deletions css/src/components/badge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ $badge-border-radius: $border-radius-rounded !default;
align-items: center;
justify-content: center;
padding: $badge-padding-block $badge-padding-inline;
border: $badge-border-width solid $border-white-high-contrast;
Copy link
Contributor

Choose a reason for hiding this comment

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

Revert and maybe update border-white-high-contrast

border: $badge-border-width solid $colorNeutralStroke2;
border-radius: $badge-border-radius;
background-color: $colorNeutralBackground4;
color: $colorNeutralForeground3;
font-size: $badge-font-size;
font-weight: $badge-font-weight;
line-height: $line-height-normal;
Expand All @@ -32,15 +34,15 @@ $badge-border-radius: $border-radius-rounded !default;
$dark: nth($color-set, $color-index-dark);
$background: nth($color-set, $color-index-background);

@if $name == 'secondary' {
border-color: $dark;
background-color: $background;
color: $dark;
} @else {
&.badge-#{$name} {
&.badge-#{$name} {
@if $name == 'info' or $name == 'secondary' or $name == 'tertiary' or $name == 'warning' {
border-color: $dark;
background-color: $background;
color: $dark;
} @else {
border-color: $base;
background-color: $background;
color: $base;
}
}
}
Expand All @@ -51,24 +53,34 @@ $badge-border-radius: $border-radius-rounded !default;
}

&.badge-filled {
background-color: $colorNeutralBackground5;

@each $name, $color-set in $colors {
$base: nth($color-set, $color-index-base);
$invert: nth($color-set, $color-index-invert);
$dark: nth($color-set, $color-index-dark);
$background: nth($color-set, $color-index-background);

@if $name == 'secondary' {
border-color: $base;
background-color: $base;
color: $invert;
} @else {
&.badge-#{$name} {
&.badge-#{$name} {
/* stylelint-disable-next-line max-nesting-depth */
@if $name == 'secondary' {
border-color: $base;
background-color: $base;
color: $invert;

/* stylelint-disable-next-line max-nesting-depth */
} @else {
border-color: $base;
background-color: $base;
color: $invert;
}
}
}

.theme-high-contrast & {
background-color: $alternate-background;
color: $text-invert;
}
}

.icon {
Expand Down
27 changes: 20 additions & 7 deletions css/src/components/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

$button-color: $text !default;
$button-background-color: $body-background !default;
$button-color-fluent: $text-fluent !default;
$button-color-subtle-fluent: $colorNeutralForeground2 !default;
$button-background-color-fluent: $body-background-fluent !default;

$button-lg-font-size: $font-size-6 !default;
$button-sm-font-size: $font-size-8 !default;
Expand All @@ -12,12 +15,18 @@ $button-border-color: $text-subtle !default;
$button-border-width: $control-border-width !default;
$button-border-radius: $control-radius !default;

$button-border-color-fluent: $colorNeutralStroke1 !default;

$button-padding-vertical: calc(0.375em - #{$button-border-width}) !default;
$button-padding-horizontal: 0.75em !default;

$button-hover-color: $text !default;
$button-hover-border-color: $default-hover !default;
$button-hover-background-color: $default-hover-invert !default;
$button-hover-background-color: $default-hover !default;

$button-hover-color-fluent: $default-hover-fluent !default;
$button-hover-border-color-fluent: $default-hover-border-fluent !default;
$button-hover-background-color-fluent: $default-hover-background-fluent !default;

$button-disabled-background-color: $body-background-medium !default;
$button-disabled-shadow: none !default;
Expand All @@ -35,8 +44,8 @@ $button-font-weight: $weight-semibold !default;
padding-block-end: $button-padding-vertical;
border-width: $button-border-width;
border-radius: $button-border-radius;
border-color: $button-border-color;
background-color: $button-background-color;
border-color: $button-border-color-fluent;
background-color: $button-background-color-fluent;
color: $button-color;
font-weight: $button-font-weight;
text-align: center;
Expand Down Expand Up @@ -67,9 +76,9 @@ $button-font-weight: $weight-semibold !default;

&:hover,
&.is-hovered {
border-color: $button-hover-border-color;
background-color: $button-hover-background-color;
color: $button-hover-color;
border-color: $button-hover-border-color-fluent;
background-color: $button-hover-background-color-fluent;
color: $button-hover-color-fluent;
}

&:visited {
Expand Down Expand Up @@ -143,10 +152,13 @@ $button-font-weight: $weight-semibold !default;
}

$button-clear-hover-background-color: transparentize(#8e8e8e, 0.95) !default;
$button-clear-hover-background-color-fluent: $button-hover-background-color-fluent;
$button-clear-hover-color-fluent: $colorNeutralForeground2Hover;

.button.button-clear {
border-color: transparent;
background-color: transparent;
color: $button-color-subtle-fluent;

&.border {
// an allowed hack to make for flexible outlined buttons
Expand All @@ -162,7 +174,8 @@ $button-clear-hover-background-color: transparentize(#8e8e8e, 0.95) !default;
&.is-hovered,
&:hover,
&:active {
background-color: $button-clear-hover-background-color;
background-color: $button-clear-hover-background-color-fluent;
color: $button-clear-hover-color-fluent;
}

@each $name, $color-set in $colors {
Expand Down
2 changes: 1 addition & 1 deletion css/src/components/form/form.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* stylelint-disable max-nesting-depth, selector-max-specificity */

$field-line-height: 1.5 !default;
$field-error-color: $danger !default;
$field-error-color: $colorPaletteRedForeground1 !default;

.field {
&:not(:last-child) {
Expand Down
25 changes: 20 additions & 5 deletions css/src/components/notification.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$notification-background: $secondary-background !default;
$notification-background: $secondary-background-fluent !default;
$notification-padding: $spacer-5 !default;

$notification-font-size: $font-size-7 !default;
$notification-color: $text !default;
$notification-color: $text-fluent !default;

$notification-border-color: $control-border !default;
$notification-border-width: $border-width !default;
Expand Down Expand Up @@ -33,11 +33,26 @@ $notification-dismiss-margin: $spacer-2 !default;
$base: nth($color-set, $color-index-base);
$dark: nth($color-set, $color-index-dark);
$background: nth($color-set, $color-index-background);
$border: nth($color-set, $color-index-border);

&.notification-#{$name} {
border-color: $dark;
background-color: $background;
color: $dark;
@if $name == 'tertiary' {
border-color: $border;
Copy link
Contributor

@wibjorn wibjorn Oct 31, 2024

Choose a reason for hiding this comment

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

To me, this indicates we may not be on the right track with how we're updating. Lots more @if statements in the Sass now. Mind outlining why that might be? Perhaps writing more about the problem might help us come to a different solution?

background-color: $background;
color: $dark;
} @else if $name == 'secondary' {
border-color: $border;
background-color: $background;
color: $dark;
} @else if $name == 'info' {
border-color: $border;
background-color: $background;
color: $dark;
} @else {
border-color: $border;
background-color: $background;
color: $text-fluent;
}

&.is-loading::before {
border-color: transparent transparent $dark $dark;
Expand Down
12 changes: 11 additions & 1 deletion css/src/components/progress-bar.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
$progress-bar-background-color: $secondary-background-glow-high-contrast !default;
$progress-bar-value-background-color: $primary !default;
$progress-bar-value-background-color-warning: $warning !default;
$progress-bar-value-background-color-warning: $colorPaletteDarkOrangeBackground3 !default;
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid using palette colors directly. it should be a theme color with a semantic name if possible

Copy link
Contributor Author

Choose a reason for hiding this comment

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

$colorPaletteDarkOrangeBackground3 actually refers to the theme map, it just doesn't have a semantic name. Fluent has a semantic warning color, but they also use non-semantically named colors. For this instance, they chose to use a non-semantic color instead of their standard warning colors. The challenge here is that there is a lack of consistency at times. Perhaps I can set this color as warning-alternate.

$progress-bar-value-background-color-danger: $danger !default;
$progress-bar-value-background-color-success: $success !default;
$progress-bar-height: $spacer-2 !default;
Expand Down Expand Up @@ -70,6 +70,16 @@ $progress-bar-indeterminate-animation-duration: 2s !default;
}
}

.theme-dark &.progress-bar-warning {
Copy link
Contributor

Choose a reason for hiding this comment

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

.theme-dark &.* selectors are final resorts, do we definitely need this? can we instead add something to the theme maps?

&::-webkit-progress-value {
background-color: $progress-bar-value-background-color-warning;
}

&::-moz-progress-bar {
background-color: $progress-bar-value-background-color-warning;
}
}

&:indeterminate {
animation-name: slide-background;
animation-timing-function: linear;
Expand Down
Loading
Loading