diff --git a/.changeset/cuddly-apricots-protect.md b/.changeset/cuddly-apricots-protect.md new file mode 100644 index 0000000000..da03928156 --- /dev/null +++ b/.changeset/cuddly-apricots-protect.md @@ -0,0 +1,5 @@ +--- +"@primer/css": minor +--- + +Replacing deprecated variables with color v2 variables diff --git a/src/alerts/flash.scss b/src/alerts/flash.scss index 55cc9b411e..14c9f6fb58 100644 --- a/src/alerts/flash.scss +++ b/src/alerts/flash.scss @@ -64,42 +64,42 @@ // .flash { - color: var(--color-alert-info-text); - background-image: linear-gradient(var(--color-alert-info-bg), var(--color-alert-info-bg)); - border-color: var(--color-alert-info-border); + color: var(--color-fg-default); + background-image: linear-gradient(var(--color-accent-subtle), var(--color-accent-subtle)); + border-color: var(--color-accent-muted); .octicon { - color: var(--color-alert-info-icon); + color: var(--color-accent-fg); } } .flash-warn { - color: var(--color-alert-warn-text); - background-image: linear-gradient(var(--color-alert-warn-bg), var(--color-alert-warn-bg)); - border-color: var(--color-alert-warn-border); + color: var(--color-fg-default); + background-image: linear-gradient(var(--color-attention-subtle), var(--color-attention-subtle)); + border-color: var(--color-attention-muted); .octicon { - color: var(--color-alert-warn-icon); + color: var(--color-attention-fg); } } .flash-error { - color: var(--color-alert-error-text); - background-image: linear-gradient(var(--color-alert-error-bg), var(--color-alert-error-bg)); - border-color: var(--color-alert-error-border); + color: var(--color-fg-default); + background-image: linear-gradient(var(--color-danger-subtle), var(--color-danger-subtle)); + border-color: var(--color-danger-muted); .octicon { - color: var(--color-alert-error-icon); + color: var(--color-danger-fg); } } .flash-success { - color: var(--color-alert-success-text); - background-image: linear-gradient(var(--color-alert-success-bg), var(--color-alert-success-bg)); - border-color: var(--color-alert-success-border); + color: var(--color-fg-default); + background-image: linear-gradient(var(--color-success-subtle), var(--color-success-subtle)); + border-color: var(--color-success-muted); .octicon { - color: var(--color-alert-success-icon); + color: var(--color-success-fg); } } @@ -129,7 +129,7 @@ // Makes sure the background is opaque to cover any content underneath .flash-full, .flash-banner { - background-color: var(--color-bg-canvas); + background-color: var(--color-canvas-default); } // FIXME deprecate this @@ -138,5 +138,5 @@ // stylelint-disable-next-line primer/spacing margin-bottom: 0.8em; font-weight: $font-weight-bold; - background-color: var(--color-alert-warn-bg); + background-color: var(--color-attention-subtle); } diff --git a/src/autocomplete/autocomplete.scss b/src/autocomplete/autocomplete.scss index 19db064731..f543397c16 100644 --- a/src/autocomplete/autocomplete.scss +++ b/src/autocomplete/autocomplete.scss @@ -8,10 +8,10 @@ // stylelint-disable-next-line primer/typography font-size: 13px; list-style: none; - background: var(--color-bg-overlay); - border: $border-width $border-style var(--color-border-primary); + background: var(--color-canvas-overlay); + border: $border-width $border-style var(--color-border-default); border-radius: $border-radius; - box-shadow: var(--color-autocomplete-shadow); + box-shadow: var(--color-shadow-medium); } // One of the items that appears within an autocomplete group @@ -23,19 +23,19 @@ padding: $spacer-1 $spacer-2; overflow: hidden; font-weight: $font-weight-bold; - color: var(--color-text-primary); + color: var(--color-fg-default); text-align: left; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; - background-color: var(--color-bg-overlay); + background-color: var(--color-canvas-overlay); border: 0; &:hover { - color: var(--color-state-hover-primary-text); + color: var(--color-fg-on-emphasis); text-decoration: none; - background-color: var(--color-state-hover-primary-bg); + background-color: var(--color-accent-emphasis); // Inherit color on all child elements to ensure enough contrast * { @@ -46,9 +46,9 @@ &.selected, &[aria-selected=true], &.navigation-focus { - color: var(--color-state-selected-primary-text); + color: var(--color-fg-on-emphasis); text-decoration: none; - background-color: var(--color-state-selected-primary-bg); + background-color: var(--color-accent-emphasis); // Inherit color on all child elements to ensure enough contrast * { diff --git a/src/autocomplete/suggester.scss b/src/autocomplete/suggester.scss index 526c6afae0..cb5e4bfb0c 100644 --- a/src/autocomplete/suggester.scss +++ b/src/autocomplete/suggester.scss @@ -11,20 +11,20 @@ margin-top: $spacer-4; list-style: none; cursor: pointer; - background: var(--color-bg-overlay); - border: $border-width $border-style var(--color-border-primary); + background: var(--color-canvas-overlay); + border: $border-width $border-style var(--color-border-default); border-radius: $border-radius; - box-shadow: var(--color-autocomplete-shadow); + box-shadow: var(--color-shadow-medium); li { display: block; padding: $spacer-1 $spacer-2; font-weight: $font-weight-semibold; - border-bottom: $border-width $border-style var(--color-autocomplete-row-border); + border-bottom: $border-width $border-style var(--color-border-muted); small { font-weight: $font-weight-normal; - color: var(--color-text-secondary); + color: var(--color-fg-muted); } &:last-child { @@ -39,23 +39,23 @@ } &:hover { - color: var(--color-state-hover-primary-text); + color: var(--color-fg-on-emphasis); text-decoration: none; - background: var(--color-state-hover-primary-bg); + background: var(--color-accent-emphasis); small { - color: var(--color-state-hover-primary-text); + color: var(--color-fg-on-emphasis); } } &[aria-selected="true"], &.navigation-focus { - color: var(--color-state-selected-primary-text); + color: var(--color-fg-on-emphasis); text-decoration: none; - background: var(--color-state-selected-primary-bg); + background: var(--color-accent-emphasis); small { - color: var(--color-state-selected-primary-text); + color: var(--color-fg-on-emphasis); } } } diff --git a/src/avatars/avatar-parent-child.scss b/src/avatars/avatar-parent-child.scss index 8ca126bdbc..e3185f8068 100644 --- a/src/avatars/avatar-parent-child.scss +++ b/src/avatars/avatar-parent-child.scss @@ -10,7 +10,7 @@ position: absolute; right: -15%; bottom: -9%; - background-color: var(--color-bg-canvas); // For transparent backgrounds + background-color: var(--color-canvas-default); // For transparent backgrounds // stylelint-disable-next-line primer/borders border-radius: $border-radius-1; box-shadow: var(--color-avatar-child-shadow); diff --git a/src/avatars/avatar-stack.scss b/src/avatars/avatar-stack.scss index f8ed8091d9..e445b99554 100644 --- a/src/avatars/avatar-stack.scss +++ b/src/avatars/avatar-stack.scss @@ -21,7 +21,7 @@ .AvatarStack-body { display: flex; - background: var(--color-bg-canvas); + background: var(--color-canvas-default); .avatar { position: relative; @@ -32,8 +32,8 @@ box-sizing: content-box; // stylelint-disable-next-line primer/spacing margin-right: -11px; - background-color: var(--color-bg-canvas); - border-right: $border-width $border-style var(--color-bg-canvas); + background-color: var(--color-canvas-default); + border-right: $border-width $border-style var(--color-canvas-default); // stylelint-disable-next-line primer/borders border-radius: $border-radius-1; transition: margin 0.1s ease-in-out; @@ -82,7 +82,7 @@ .avatar.avatar-more { z-index: 1; margin-right: 0; - background: var(--color-bg-tertiary); + background: var(--color-canvas-subtle); &::before, &::after { @@ -92,7 +92,7 @@ content: ""; // stylelint-disable-next-line primer/borders border-radius: 2px; - outline: $border-width $border-style var(--color-bg-canvas); + outline: $border-width $border-style var(--color-canvas-default); } &::before { @@ -129,7 +129,7 @@ &::after { width: 2px; - background: var(--color-bg-tertiary); + background: var(--color-canvas-subtle); } } @@ -138,6 +138,6 @@ // stylelint-disable-next-line primer/spacing margin-left: -11px; border-right: 0; - border-left: $border-width $border-style var(--color-bg-canvas); + border-left: $border-width $border-style var(--color-canvas-default); } } diff --git a/src/avatars/circle-badge.scss b/src/avatars/circle-badge.scss index 0c994ca173..2bc5d7f680 100644 --- a/src/avatars/circle-badge.scss +++ b/src/avatars/circle-badge.scss @@ -4,7 +4,7 @@ display: flex; align-items: center; justify-content: center; - background-color: var(--color-bg-canvas); + background-color: var(--color-canvas-default); border-radius: 50%; box-shadow: var(--color-shadow-medium); } @@ -46,7 +46,7 @@ width: 100%; content: ""; // stylelint-disable-next-line primer/borders - border-bottom: 2px dashed var(--color-border-primary); + border-bottom: 2px dashed var(--color-border-default); } .CircleBadge { diff --git a/src/base/base.scss b/src/base/base.scss index 8b6fbb072e..47f6fd73a0 100644 --- a/src/base/base.scss +++ b/src/base/base.scss @@ -16,12 +16,12 @@ body { font-family: $body-font; font-size: $body-font-size; line-height: $body-line-height; - color: var(--color-text-primary); - background-color: var(--color-bg-canvas); + color: var(--color-fg-default); + background-color: var(--color-canvas-default); } a { - color: var(--color-text-link); + color: var(--color-accent-fg); text-decoration: none; &:hover { @@ -45,7 +45,7 @@ hr, overflow: hidden; background: transparent; border: 0; - border-bottom: $border-width $border-style var(--color-border-secondary); + border-bottom: $border-width $border-style var(--color-border-muted); @include clearfix(); } diff --git a/src/base/kbd.scss b/src/base/kbd.scss index 033c03a1d6..b63afc70c0 100644 --- a/src/base/kbd.scss +++ b/src/base/kbd.scss @@ -8,13 +8,13 @@ kbd { font: 11px $mono-font; // stylelint-disable-next-line primer/typography line-height: 10px; - color: var(--color-text-primary); + color: var(--color-fg-default); vertical-align: middle; - background-color: var(--color-bg-secondary); + background-color: var(--color-canvas-subtle); // stylelint-disable-next-line primer/borders - border: $border-style $border-width var(--color-border-tertiary); - border-bottom-color: var(--color-border-tertiary); + border: $border-style $border-width var(--color-neutral-muted); + border-bottom-color: var(--color-neutral-muted); border-radius: $border-radius; // stylelint-disable-next-line primer/box-shadow - box-shadow: inset 0 -1px 0 var(--color-border-tertiary); + box-shadow: inset 0 -1px 0 var(--color-neutral-muted); } diff --git a/src/base/modes.scss b/src/base/modes.scss index e90f5209f2..1691ee7b42 100644 --- a/src/base/modes.scss +++ b/src/base/modes.scss @@ -30,8 +30,8 @@ // Enables nesting of different color modes [data-color-mode] { - color: var(--color-text-primary); - background-color: var(--color-bg-canvas); + color: var(--color-fg-default); + background-color: var(--color-canvas-default); } // color-scheme diff --git a/src/blankslate/blankslate.scss b/src/blankslate/blankslate.scss index 12fe605423..d88e4eac96 100644 --- a/src/blankslate/blankslate.scss +++ b/src/blankslate/blankslate.scss @@ -5,15 +5,15 @@ text-align: center; p { - color: var(--color-text-secondary); + color: var(--color-fg-muted); } code { // stylelint-disable-next-line primer/spacing padding: 2px 5px 3px; font-size: $h5-size; - background: var(--color-bg-canvas); - border: $border-width $border-style var(--color-border-secondary); + background: var(--color-canvas-default); + border: $border-width $border-style var(--color-border-muted); border-radius: $border-radius; } @@ -27,7 +27,7 @@ margin-right: $spacer-1; margin-bottom: $spacer-2; margin-left: $spacer-1; - color: var(--color-icon-secondary); + color: var(--color-fg-muted); } .blankslate-capped { diff --git a/src/box/box.scss b/src/box/box.scss index dd828b0ae3..b3e41eb0d0 100644 --- a/src/box/box.scss +++ b/src/box/box.scss @@ -2,8 +2,8 @@ // Intended to replace simple-box, boxed-group, and table-list .Box { - background-color: var(--color-bg-primary); - border-color: var(--color-border-primary); + background-color: var(--color-canvas-default); + border-color: var(--color-border-default); border-style: $border-style; border-width: $border-width; border-radius: $border-radius; @@ -74,8 +74,8 @@ padding: $spacer-3; // stylelint-disable-next-line primer/spacing margin: (-$border-width) (-$border-width) 0; - background-color: var(--color-bg-tertiary); - border-color: var(--color-border-primary); + background-color: var(--color-canvas-subtle); + border-color: var(--color-border-default); border-style: $border-style; border-width: $border-width; border-top-left-radius: $border-radius; @@ -89,7 +89,7 @@ .Box-body { padding: $spacer-3; - border-bottom: $border-width $border-style var(--color-border-primary); + border-bottom: $border-width $border-style var(--color-border-default); // Ensures bottom-border doesn't poke out when .Box-body used without box-footer &:last-of-type { @@ -106,7 +106,7 @@ // stylelint-disable-next-line primer/spacing margin-top: -1px; list-style-type: none; // To account for applying Box component to a list - border-top-color: var(--color-border-secondary); + border-top-color: var(--color-border-muted); border-top-style: $border-style; border-top-width: $border-width; @@ -126,13 +126,13 @@ // .unread to be deprecated with .Box-row-unread &.unread { // stylelint-disable-next-line primer/box-shadow - box-shadow: inset 2px 0 0 var(--color-border-info); + box-shadow: inset 2px 0 0 var(--color-accent-emphasis); } &.navigation-focus { // Focus styles for when drag icon .Box-row--drag-button { - color: var(--color-text-link); + color: var(--color-accent-fg); cursor: grab; opacity: 100; } @@ -144,12 +144,12 @@ // Row dragging styles &.sortable-chosen { - background-color: var(--color-bg-secondary); + background-color: var(--color-canvas-subtle); } // Makes dragging row background gray &.sortable-ghost { - background-color: var(--color-bg-tertiary); + background-color: var(--color-canvas-subtle); // Hides contents of row while dragging so row looks solid gray .Box-row--drag-hide { @@ -161,25 +161,25 @@ .Box-row--focus-gray { &.navigation-focus { - background-color: var(--color-bg-tertiary); + background-color: var(--color-canvas-subtle); } } .Box-row--focus-blue { &.navigation-focus { - background-color: var(--color-box-row-blue-bg); + background-color: var(--color-accent-subtle); } } .Box-row--hover-gray { &:hover { - background-color: var(--color-bg-tertiary); + background-color: var(--color-canvas-subtle); } } .Box-row--hover-blue { &:hover { - background-color: var(--color-box-row-blue-bg); + background-color: var(--color-accent-subtle); } } @@ -188,11 +188,11 @@ // and links are dark-gray with blue hover on desktop. .Box-row-link { @include breakpoint(md) { - color: var(--color-text-primary); + color: var(--color-fg-default); text-decoration: none; &:hover { - color: var(--color-text-link); + color: var(--color-accent-fg); text-decoration: none; } } @@ -208,7 +208,7 @@ padding: $spacer-3; // stylelint-disable-next-line primer/spacing margin-top: -1px; // prevents double border when used with .Box-body - border-top-color: var(--color-border-primary); + border-top-color: var(--color-border-default); border-top-style: $border-style; border-top-width: $border-width; border-radius: 0 0 $border-radius $border-radius; @@ -223,61 +223,61 @@ // Box themes .Box--blue { - border-color: var(--color-box-blue-border); + border-color: var(--color-accent-muted); .Box-header { - background-color: var(--color-bg-info); - border-color: var(--color-box-blue-border); + background-color: var(--color-accent-subtle); + border-color: var(--color-accent-muted); } .Box-body { - border-color: var(--color-box-blue-border); + border-color: var(--color-accent-muted); } .Box-row { - border-color: var(--color-box-blue-border); + border-color: var(--color-accent-muted); } .Box-footer { - border-color: var(--color-box-blue-border); + border-color: var(--color-accent-muted); } } // Applies and red border to the outside of the box, // but not to the border separating rows. .Box--danger { - border-color: var(--color-border-danger); + border-color: var(--color-danger-emphasis); .Box-row { &:first-of-type { - border-color: var(--color-border-danger); + border-color: var(--color-danger-emphasis); } } .Box-body { &:last-of-type { - border-color: var(--color-border-danger); + border-color: var(--color-danger-emphasis); } } } .Box-header--blue { - background-color: var(--color-box-header-blue-bg); - border-color: var(--color-box-header-blue-border); + background-color: var(--color-accent-subtle); + border-color: var(--color-accent-muted); } // Box row highlight themes .Box-row--yellow { - background-color: var(--color-box-row-yellow-bg); + background-color: var(--color-attention-subtle); } .Box-row--blue { - background-color: var(--color-box-row-blue-bg); + background-color: var(--color-accent-subtle); } .Box-row--gray { - background-color: var(--color-bg-tertiary); + background-color: var(--color-canvas-subtle); } //Box with btn-octicon diff --git a/src/branch-name/branch-name.scss b/src/branch-name/branch-name.scss index e58c0e5f47..3209be98a7 100644 --- a/src/branch-name/branch-name.scss +++ b/src/branch-name/branch-name.scss @@ -7,24 +7,24 @@ // stylelint-disable-next-line primer/spacing padding: 2px 6px; font: 12px $mono-font; - color: var(--color-branch-name-text); - background-color: var(--color-branch-name-bg); + color: var(--color-fg-muted); + background-color: var(--color-accent-subtle); border-radius: $border-radius; .octicon { // stylelint-disable-next-line primer/spacing margin: 1px -2px 0 0; - color: var(--color-branch-name-icon); + color: var(--color-fg-muted); } } // When a branch name is a link a.branch-name { - color: var(--color-text-link); - background-color: var(--color-branch-name-link-bg); + color: var(--color-accent-fg); + background-color: var(--color-accent-subtle); .octicon { - color: var(--color-branch-name-link-icon); + color: var(--color-accent-fg); } } diff --git a/src/breadcrumb/breadcrumb.scss b/src/breadcrumb/breadcrumb.scss index 2ea34db9a7..85e630c20e 100644 --- a/src/breadcrumb/breadcrumb.scss +++ b/src/breadcrumb/breadcrumb.scss @@ -11,7 +11,7 @@ margin: 0 $em-spacer-5; content: ''; // stylelint-disable-next-line primer/borders - border-right: 0.1em $border-style var(--color-text-disabled); + border-right: 0.1em $border-style var(--color-fg-muted); transform: rotate(15deg); } @@ -22,7 +22,7 @@ .breadcrumb-item-selected, .breadcrumb-item[aria-current]:not([aria-current=false]) { - color: var(--color-text-primary); + color: var(--color-fg-default); &::after { content: none; diff --git a/src/buttons/button.scss b/src/buttons/button.scss index 9cdafb8287..3d36c37b81 100644 --- a/src/buttons/button.scss +++ b/src/buttons/button.scss @@ -28,7 +28,7 @@ cursor: default; .octicon { - color: var(--color-icon-tertiary); + color: var(--color-fg-muted); } } @@ -40,7 +40,7 @@ .octicon { margin-right: $spacer-1; - color: var(--color-text-tertiary); + color: var(--color-fg-muted); vertical-align: text-bottom; &:only-child { @@ -90,13 +90,13 @@ &.selected, &[aria-selected=true] { background-color: var(--color-btn-selected-bg); - box-shadow: var(--color-shadow-inset); + box-shadow: var(--color-primer-shadow-inset); } &:disabled, &.disabled, &[aria-disabled=true] { - color: var(--color-text-disabled); + color: var(--color-fg-muted); background-color: var(--color-btn-bg); border-color: var(--color-btn-border); } diff --git a/src/buttons/misc.scss b/src/buttons/misc.scss index 7af10000b5..2e307e9530 100644 --- a/src/buttons/misc.scss +++ b/src/buttons/misc.scss @@ -7,7 +7,7 @@ display: inline-block; padding: 0; font-size: inherit; - color: var(--color-text-link); + color: var(--color-accent-fg); text-decoration: none; white-space: nowrap; cursor: pointer; @@ -24,7 +24,7 @@ &[aria-disabled=true] { &, &:hover { - color: var(--color-text-disabled); + color: var(--color-fg-muted); cursor: default; } } @@ -34,7 +34,7 @@ // // Typically used as a "cancel" button next to a .btn .btn-invisible { - color: var(--color-text-link); + color: var(--color-accent-fg); background-color: transparent; // Reset default gradient backgrounds and colors border: 0; border-radius: 0; @@ -42,7 +42,7 @@ &:hover, &.zeroclipboard-is-hover { - color: var(--color-text-link); + color: var(--color-accent-fg); background: none; outline: none; box-shadow: none; @@ -53,7 +53,7 @@ &.selected, &[aria-selected=true], &.zeroclipboard-is-active { - color: var(--color-text-link); + color: var(--color-accent-fg); background: none; border-color: var(--color-btn-active-border); outline: none; @@ -77,7 +77,7 @@ // stylelint-disable-next-line primer/spacing margin-left: 5px; line-height: $lh-condensed-ultra; - color: var(--color-text-secondary); + color: var(--color-fg-muted); vertical-align: middle; // For `