Skip to content

Commit

Permalink
Add Primitive v8 colors (take 3) (#2123)
Browse files Browse the repository at this point in the history
Co-authored-by: langermank <langermank@users.noreply.github.com>
Co-authored-by: Jon Rohan <rohan@github.com>
  • Loading branch information
3 people authored Jul 13, 2023
1 parent 4fccc17 commit f9119d9
Show file tree
Hide file tree
Showing 118 changed files with 1,021 additions and 7,503 deletions.
7 changes: 7 additions & 0 deletions .changeset/yellow-ducks-act.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@primer/view-components": minor
---

- Use Primitive v8 color tokens
- Add tests for compiled CSS to ensure CSS color variables have a fallback

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"extends": ["stylelint-config-standard", "stylelint-config-prettier"],
"plugins": ["@primer/stylelint-config/plugins/no-deprecated-colors"],
"ignoreFiles": ["app/**/*.css", "**/*.js", "**/*.ts"],
"rules": {
"custom-property-pattern": null,
Expand All @@ -14,6 +15,7 @@
{
"ignoreAtRules": ["mixin", "define-mixin"]
}
]
],
"primer/no-deprecated-colors": true
}
}
2 changes: 1 addition & 1 deletion app/components/primer/alpha/action_bar.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
.ActionBar-divider {
height: calc(var(--control-medium-size) / 2);
margin: 0 var(--controlStack-medium-gap-condensed);
border-left: var(--borderWidth-thin) solid var(--color-border-subtle);
border-left: var(--borderWidth-thin) solid var(--borderColor-muted);
}

.ActionBar--small .ActionBar-divider {
Expand Down
84 changes: 42 additions & 42 deletions app/components/primer/alpha/action_list.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
width: 100%;
height: 1px;
content: '';
background: var(--color-action-list-item-inline-divider);
background: var(--borderColor-muted, var(--color-action-list-item-inline-divider));
}

/* if descriptionWrap--inline exists, move pseudo divider to wrapper */
Expand All @@ -40,7 +40,7 @@
width: 100%;
height: var(--borderWidth-thin);
content: '';
background: var(--color-action-list-item-inline-divider);
background: var(--borderColor-muted, var(--color-action-list-item-inline-divider));
}

/* unset the default label pseudo */
Expand Down Expand Up @@ -75,7 +75,7 @@
.ActionListItem {
position: relative;
list-style: none;
background-color: transparent;
background-color: var(--control-transparent-bgColor-rest);
border-radius: var(--borderRadius-medium);

/* state */
Expand Down Expand Up @@ -113,12 +113,12 @@

@media (hover: hover) {
&:hover {
background-color: var(--color-action-list-item-default-hover-bg);
background-color: var(--control-transparent-bgColor-hover);
}
}

&:active {
background-color: var(--color-action-list-item-default-active-bg);
background-color: var(--control-transparent-bgColor-active);
}
}
}
Expand All @@ -130,25 +130,25 @@
@media (hover: hover) {
&:hover {
cursor: pointer;
background-color: var(--color-action-list-item-default-hover-bg);
background-color: var(--control-transparent-bgColor-hover);

&:not(.ActionListItem--navActive, :focus-visible) {
/* Support for "Windows high contrast mode" */
outline: solid var(--borderWidth-thin) transparent;
outline-offset: calc(-1 * var(--borderWidth-thin));
box-shadow: var(--boxShadow-thin) var(--color-action-list-item-default-active-border);
box-shadow: var(--boxShadow-thin) var(--control-transparent-borderColor-active);
}
}
}

&:active {
background: var(--color-action-list-item-default-active-bg);
background: var(--control-transparent-bgColor-active);

&:not(.ActionListItem--navActive) {
/* Support for "Windows high contrast mode" https:sarahmhigley.com/writing/whcm-quick-tips/ */
outline: solid var(--borderWidth-thin) transparent;
outline-offset: calc(-1 * var(--borderWidth-thin));
box-shadow: var(--boxShadow-thin) var(--color-action-list-item-default-active-border);
box-shadow: var(--boxShadow-thin) var(--control-transparent-borderColor-active);
}

& .ActionListItem-label::before,
Expand All @@ -162,11 +162,11 @@

&[aria-selected='true'] {
font-weight: var(--base-text-weight-normal);
background: var(--color-action-list-item-default-selected-bg);
background: var(--control-transparent-bgColor-selected);

@media (hover: hover) {
&:hover {
background-color: var(--color-action-list-item-default-hover-bg);
background-color: var(--control-transparent-bgColor-hover);
}
}

Expand Down Expand Up @@ -195,11 +195,11 @@
}

&:not(.ActionListItem--danger) {
background: var(--color-action-list-item-default-selected-bg);
background: var(--control-transparent-bgColor-selected);

@media (hover: hover) {
&:hover {
background-color: var(--color-action-list-item-default-hover-bg);
background-color: var(--control-transparent-bgColor-hover);
}
}

Expand All @@ -222,11 +222,11 @@
& .ActionListContent {
& .ActionListItem-label,
& .ActionListItem-description {
color: var(--color-primer-fg-disabled);
color: var(--control-fgColor-disabled);
}

& .ActionListItem-visual {
fill: var(--color-primer-fg-disabled);
fill: var(--control-fgColor-disabled);
}
}

Expand All @@ -243,31 +243,31 @@
/* danger */
&.ActionListItem--danger {
& .ActionListItem-label {
color: var(--color-danger-fg);
color: var(--control-danger-fgColor-rest);
}

& .ActionListItem-visual {
color: var(--color-danger-fg);
color: var(--control-danger-fgColor-rest);
}

@media (hover: hover) {
&:hover {
background: var(--color-action-list-item-danger-hover-bg);
background: var(--control-danger-bgColor-hover);

& .ActionListItem-label,
& .ActionListItem-visual {
color: var(--color-action-list-item-danger-hover-text);
color: var(--control-danger-fgColor-hover);
}
}
}

& .ActionListContent {
&:active {
background: var(--color-action-list-item-danger-active-bg);
background: var(--control-danger-bgColor-active);

& .ActionListItem-label,
& .ActionListItem-visual {
color: var(--color-action-list-item-danger-hover-text);
color: var(--control-danger-fgColor-hover);
}
}
}
Expand All @@ -281,7 +281,7 @@
width: 100%;
padding-block: var(--actionListContent-paddingBlock);
padding-inline: var(--control-medium-paddingInline-condensed);
color: var(--color-fg-default);
color: var(--control-fgColor-rest);
text-align: left;
user-select: none;
background-color: transparent;
Expand Down Expand Up @@ -310,11 +310,11 @@
&[aria-disabled='true'] {
& .ActionListItem-label,
& .ActionListItem-description {
color: var(--color-primer-fg-disabled);
color: var(--control-fgColor-disabled);
}

& .ActionListItem-visual {
fill: var(--color-primer-fg-disabled);
fill: var(--control-fgColor-disabled);
}

@media (hover: hover) {
Expand Down Expand Up @@ -399,7 +399,7 @@

/* show active indicator on parent collapse if child is active */
&.ActionListContent--hasActiveSubItem {
background: var(--color-action-list-item-default-selected-bg);
background: var(--control-transparent-bgColor-selected);

& .ActionListItem-label {
font-weight: var(--base-text-weight-semibold);
Expand Down Expand Up @@ -451,13 +451,13 @@
/* checkbox */
& .ActionListItem-multiSelectIcon {
& .ActionListItem-multiSelectIconRect {
fill: var(--color-accent-fg);
stroke: var(--color-accent-fg);
fill: var(--control-checked-bgColor-rest);
stroke: var(--control-checked-bgColor-rest);
stroke-width: var(--borderWidth-thin, 1px);
}

& .ActionListItem-multiSelectCheckmark {
fill: var(--color-fg-on-emphasis);
fill: var(--fgColor-onEmphasis);
}
}
}
Expand Down Expand Up @@ -494,15 +494,15 @@
/* checkbox */
& .ActionListItem-multiSelectIcon {
& .ActionListItem-multiSelectIconRect {
fill: var(--color-canvas-default);
stroke: var(--color-border-default);
fill: var(--bgColor-default);
stroke: var(--control-borderColor-rest);
stroke-width: var(--borderWidth-thin, 1px);
}
}

& .ActionListItem-multiSelectIconRect {
fill: var(--color-canvas-default);
border: var(--borderWidth-thin, 1px) solid var(--color-border-default);
fill: var(--bgColor-default);
border: var(--borderWidth-thin, 1px) solid var(--control-borderColor-rest);
}
}

Expand Down Expand Up @@ -573,7 +573,7 @@
font-size: var(--text-body-size-small);
font-weight: var(--base-text-weight-normal);
line-height: var(--text-body-lineHeight-small);
color: var(--color-fg-muted);
color: var(--fgColor-muted);
}

/* helper for grid alignment with multi-line content
Expand All @@ -582,9 +582,9 @@
.ActionListItem-action {
display: flex;
min-height: var(--control-medium-lineBoxHeight);
color: var(--color-fg-muted);
color: var(--fgColor-muted);
pointer-events: none;
fill: var(--color-fg-muted);
fill: var(--fgColor-muted);
align-items: center;
}

Expand All @@ -594,7 +594,7 @@
font-size: var(--text-body-size-medium);
font-weight: var(--base-text-weight-normal);
line-height: var(--text-body-lineHeight-medium);
color: var(--color-fg-default);
color: var(--fgColor-default);
grid-area: label;
}

Expand Down Expand Up @@ -651,7 +651,7 @@
font-size: var(--text-body-size-small);
line-height: var(--text-body-lineHeight-small);
font-weight: var(--base-text-weight-semibold);
color: var(--color-fg-muted);
color: var(--fgColor-muted);
flex-direction: column;
}

Expand All @@ -664,24 +664,24 @@
margin-block-end: var(--base-size-8);
margin-inline: calc(-1 * var(--base-size-8));
list-style: none;
background: var(--color-action-list-item-inline-divider);
background: var(--borderColor-muted, var(--color-action-list-item-inline-divider));
border: 0;
}

& .ActionList-sectionDivider-title {
font-size: var(--text-body-size-small);
font-weight: var(--base-text-weight-semibold);
color: var(--color-fg-muted);
color: var(--fgColor-muted);
}
}

.ActionList-sectionDivider--filled {
margin-block-start: calc(var(--base-size-8) - var(--borderWidth-thin));
margin-block-end: var(--base-size-8);
margin-inline: calc(-1 * var(--base-size-8));
background: var(--color-canvas-subtle);
border-top: solid var(--borderWidth-thin) var(--color-action-list-item-inline-divider);
border-bottom: solid var(--borderWidth-thin) var(--color-action-list-item-inline-divider);
background: var(--bgColor-muted);
border-top: solid var(--borderWidth-thin) var(--borderColor-muted, var(--color-action-list-item-inline-divider));
border-bottom: solid var(--borderWidth-thin) var(--borderColor-muted, var(--color-action-list-item-inline-divider));

/* if no children, treat as divider */
&:empty {
Expand Down
20 changes: 10 additions & 10 deletions app/components/primer/alpha/auto_complete.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
align-items: center;

&:focus-within {
border-color: var(--color-accent-fg);
border-color: var(--borderColor-accent-emphasis);

@mixin focusBoxShadowInset;
}
Expand Down Expand Up @@ -68,10 +68,10 @@
overflow-y: auto;
font-size: 13px;
list-style: none;
background: var(--color-canvas-overlay);
border: var(--borderWidth-thin) solid var(--color-border-default);
background: var(--overlay-bgColor);
border: var(--borderWidth-thin) solid var(--borderColor-default);
border-radius: var(--borderRadius-medium);
box-shadow: var(--color-shadow-medium);
box-shadow: var(--shadow-resting-medium);
}

/* One of the items that appears within an autocomplete group
Expand All @@ -83,19 +83,19 @@
padding: 4px 8px;
overflow: hidden;
font-weight: var(--base-text-weight-semibold);
color: var(--color-fg-default);
color: var(--fgColor-default);
text-align: left;
text-decoration: none;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;
background-color: var(--color-canvas-overlay);
background-color: var(--overlay-bgColor);
border: 0;

&:hover {
color: var(--color-fg-on-emphasis);
color: var(--fgColor-onEmphasis);
text-decoration: none;
background-color: var(--color-accent-emphasis);
background-color: var(--bgColor-accent-emphasis);

/* Inherit color on all child elements to ensure enough contrast */
& * {
Expand All @@ -106,9 +106,9 @@
&.selected,
&[aria-selected='true'],
&.navigation-focus {
color: var(--color-fg-on-emphasis);
color: var(--fgColor-onEmphasis);
text-decoration: none;
background-color: var(--color-accent-emphasis);
background-color: var(--bgColor-accent-emphasis);

/* Inherit color on all child elements to ensure enough contrast */
& * {
Expand Down
Loading

0 comments on commit f9119d9

Please sign in to comment.