Skip to content

Commit

Permalink
feat(swatch): add support for lightBorder (#2954)
Browse files Browse the repository at this point in the history
- implement spectrum-Swatch--lightBorder class for swatches in a swatch
group that have low contrast
- build new mods for swatch-border-color-light
- add changeset
  • Loading branch information
marissahuysentruyt authored Aug 6, 2024
1 parent 4c17f22 commit 2d89227
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/pretty-socks-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@spectrum-css/swatch": minor
---

Reimplements support for the `spectrum-Swatch--lightBorder` class for swatches specifically in a swatch group.
10 changes: 10 additions & 0 deletions components/swatch/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@
/* Light theme placeholder tokens */
.spectrum--light & {
--spectrum-swatch-border-color: rgba(0, 0, 0, 51%);
--spectrum-swatch-border-color-light: rgba(0, 0, 0, 20%);
}

/* Dark and Darkest theme placeholder tokens */
.spectrum--dark &,
.spectrum--darkest & {
--spectrum-swatch-border-color: rgba(255, 255, 255, 51%);
--spectrum-swatch-border-color-light: rgba(255, 255, 255, 20%);
}
}

Expand Down Expand Up @@ -283,6 +285,14 @@
}
}

.spectrum-Swatch--lightBorder {
.spectrum-Swatch-fill {
&::before {
box-shadow: inset 0 0 0 var(--mod-swatch-border-thickness, var(--spectrum-swatch-border-thickness)) var(--highcontrast-swatch-border-color-light, var(--mod-swatch-border-color-light, var(--spectrum-swatch-border-color-light)));
}
}
}

.spectrum-Swatch-mixedValueIcon {
display: none;
pointer-events: none;
Expand Down
1 change: 1 addition & 0 deletions components/swatch/metadata/mods.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
| -------------------------------------------- |
| `--mod-animation-duration-100` |
| `--mod-swatch-border-color` |
| `--mod-swatch-border-color-light` |
| `--mod-swatch-border-color-selected` |
| `--mod-swatch-border-radius` |
| `--mod-swatch-border-thickness` |
Expand Down

0 comments on commit 2d89227

Please sign in to comment.