Skip to content

Commit

Permalink
refactor: rewrite color logic for better flexibility (#2854)
Browse files Browse the repository at this point in the history
resolves #2855 

Note: The colors are not 100% the same after the change, but the same
rules apply.

---------

Co-authored-by: Tobias Barsnes <[email protected]>
Co-authored-by: Michael Marszalek <[email protected]>
  • Loading branch information
3 people authored Dec 10, 2024
1 parent 2f68496 commit 171eba9
Show file tree
Hide file tree
Showing 54 changed files with 7,804 additions and 8,209 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-seahorses-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet-theme": patch
---

Tweaked color codes. Visually remains the same
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ test-report.xml

packages/cli/test-tokens-create
packages/cli/test-tokens-build
packages/cli/internal
25 changes: 2 additions & 23 deletions apps/_components/src/ColorModal/components/ContrastBoxes.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { CssColor } from '@adobe/leonardo-contrast-colors';
import { Heading } from '@digdir/designsystemet-react';
import type { CssColor } from '@digdir/designsystemet/color';
import type { ColorNumber } from '@digdir/designsystemet/color';
import {
areColorsContrasting,
getApcaContrastLc,
} from '@digdir/designsystemet/color';
import { areColorsContrasting } from '@digdir/designsystemet/color';
import {
CheckmarkCircleFillIcon,
ExclamationmarkTriangleFillIcon,
Expand Down Expand Up @@ -95,24 +92,6 @@ const ContrastBox = ({
}
/>
</div>

{(colorNumber === 12 || colorNumber === 13) && (
<>
<h3 className={classes.contrastSubTitle}>APCA</h3>
<div className={classes.contrastContainer}>
<ContrastItem
text='Lc75'
subText='(18px / 400)'
error={
(getApcaContrastLc(
selectedColor as CssColor,
contrastColor,
) as number) <= 75
}
/>
</div>
</>
)}
</div>
);
};
Expand Down
Loading

0 comments on commit 171eba9

Please sign in to comment.