Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
3209a3e
remove semantic modes
mimarz May 21, 2026
8efca4a
severity colors and moved color to style
mimarz May 21, 2026
15f4244
updated system files
mimarz May 21, 2026
724d423
cleaning up some
mimarz May 21, 2026
ea71281
rewrite color-scheme to use flat colors
mimarz May 21, 2026
9c2c2ba
fix sematic set
mimarz May 21, 2026
b6fa49c
test without color
mimarz May 21, 2026
540ba1a
test flattened semantic colors
mimarz May 22, 2026
f64179a
Revert "test flattened semantic colors"
mimarz May 27, 2026
791d24c
changeset
mimarz May 27, 2026
1a55555
make it work: automigrate
mimarz May 29, 2026
89c3584
move v1 config
mimarz Jun 1, 2026
edeb230
remove helpers from v1
mimarz Jun 1, 2026
a157b54
rename files
mimarz Jun 1, 2026
36ddbc1
move to separate automigrate file
mimarz Jun 1, 2026
582fade
change types and add backwars compability
mimarz Jun 1, 2026
5872d3b
add skip-check and yes options
mimarz Jun 1, 2026
09cbb06
fix type error
mimarz Jun 1, 2026
8265c1a
update designsystemet theme
mimarz Jun 2, 2026
efcfb1d
migrate test config
mimarz Jun 2, 2026
e272924
updated themebuilder
mimarz Jun 2, 2026
a96369e
fix error
mimarz Jun 2, 2026
6187588
fix missing types
mimarz Jun 2, 2026
53fc3b7
fix type error
mimarz Jun 2, 2026
27032c3
format
mimarz Jun 2, 2026
8d253d0
add stripped line ending to migrated config
mimarz Jun 2, 2026
49d8d14
fix options not working
mimarz Jun 2, 2026
e9175f6
changesets
mimarz Jun 2, 2026
59d671b
go for schema 1.1
mimarz Jun 2, 2026
3638091
update docs
mimarz Jun 2, 2026
3de0436
update some more docs
mimarz Jun 2, 2026
958f053
update docs
mimarz Jun 2, 2026
70458a1
Potential fix for pull request finding
mimarz Jun 2, 2026
1f36f6b
Potential fix for pull request finding
mimarz Jun 2, 2026
9f10cdc
Potential fix for pull request finding
mimarz Jun 2, 2026
1930e84
build digdir theme
mimarz Jun 2, 2026
cdb5b12
remove env UNSAFE_COLOR_GROUPS
mimarz Jun 4, 2026
c9a76a3
update to build colors
mimarz Jun 4, 2026
d730d09
clean up unused exports
mimarz Jun 4, 2026
7143c35
fixed how color-scheme is processed now that global is gone
mimarz Jun 4, 2026
a603f0d
build theme
mimarz Jun 4, 2026
aceeffd
Merge branch 'main' into feat-remove-color-categories
mimarz Jun 9, 2026
aa33662
fix missing link visited color
mimarz Jun 9, 2026
59af629
Merge branch 'main' into feat-remove-color-categories
mimarz Jun 16, 2026
1c53aee
bigger add color button
mimarz Jun 16, 2026
71d5cdc
remove heading
mimarz Jun 16, 2026
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/deep-brooms-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet": minor
---

Removed color categories `main` and `support`. All colors are now defined in `themes.<name>.colors` (just like neutral).
5 changes: 5 additions & 0 deletions .changeset/petite-memes-stop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet": minor
---

Removed color categories `main` and `support` support in config. Define all colors in `colors`.
5 changes: 5 additions & 0 deletions .changeset/thirty-ends-live.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet": minor
---

Remove `UNSAFE_COLOR_GROUPS` env variable as its no longer relevant
5 changes: 5 additions & 0 deletions .changeset/twelve-bugs-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@digdir/designsystemet": minor
---

Added support for auto-migrations which checks files and prompts users about needed migrations.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { useThemebuilder } from '~/routes/themebuilder/_utils/use-themebuilder';
import classes from './color-contrasts.module.css';

const initialTheme = generateColorSchemes('#0062BA');
const colorGroups = ['main', 'neutral', 'support'] as const;

export const ColorContrasts = () => {
const { t } = useTranslation();
Expand Down Expand Up @@ -110,15 +109,13 @@ const ColorContrastMapper = ({
const getMappedTheme = () => {
const mappedColors: { [key: string]: Color } = {};

let colorTheme = colors?.main[0]?.colors || initialTheme;
let colorTheme = colors?.[0]?.colors || initialTheme;

if (selectedColor !== 'dominant') {
for (const group of colorGroups) {
for (const color of colors[group]) {
if (color.name === selectedColor) {
colorTheme = color.colors;
break;
}
for (const color of colors) {
if (color.name === selectedColor) {
colorTheme = color.colors;
break;
}
}

Expand Down Expand Up @@ -167,13 +164,11 @@ const ColorContrastMapper = ({
aria-label={t('colorContrasts.select-color')}
value={selectedColor}
>
{colorGroups.flatMap((group) =>
colors[group as keyof typeof colors].map((color, colorIndex) => (
<Select.Option key={`${group}-${colorIndex}`} value={color.name}>
{color.name}
</Select.Option>
)),
)}
{colors.map((color, colorIndex) => (
<Select.Option key={`color-${colorIndex}`} value={color.name}>
{color.name}
</Select.Option>
))}
{severityEnabled &&
severityColors.map((color, index) => (
<Select.Option key={`severity-${index}`} value={color.name}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,7 @@ export const ColorPreview = () => {
useThemebuilder();
const [view, setView] = useState<ViewType>(DEFAULT_VIEW);

const allColors = [
...colors.main,
...colors.neutral,
...colors.support,
...(severityEnabled ? severityColors : []),
];
const allColors = [...colors, ...(severityEnabled ? severityColors : [])];

const prepVariables = (variables: Record<string, string>) => {
const prepped: Record<string, string> = {};
Expand Down Expand Up @@ -92,7 +87,7 @@ export const ColorPreview = () => {
};

type CardProps = {
color: ReturnType<typeof useThemebuilder>['colors']['main'][number];
color: ReturnType<typeof useThemebuilder>['colors'][number];
view?: ViewType;
} & Omit<HTMLAttributes<HTMLDivElement>, 'color'>;

Expand Down
10 changes: 4 additions & 6 deletions apps/themebuilder/app/_components/color-variables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ export const ColorVariables = () => {
const { colors, colorScheme, severityEnabled, severityColors } =
useThemebuilder();

const neutralColor = colors?.neutral[0]?.hex || '';
const [previewColor, setPreviewColor] = useState(colors?.main[0] || '');
const neutralColor = colors?.find((c) => c.name === 'neutral')?.hex || '';
const [previewColor, setPreviewColor] = useState(colors?.[0] || '');

const style = {
...styleColorVars(neutralColor as CssColor, colorScheme, 'neutral'),
...styleColorVars(previewColor.hex as CssColor, colorScheme),
};

const allColors = [
...colors.main,
...colors.neutral,
...colors.support,
...(colors ?? []),
...(severityEnabled ? severityColors : []),
];

Expand All @@ -40,7 +38,7 @@ export const ColorVariables = () => {
const selectedColor = allColors.find(
(c) => c.name === v.target.value,
);
setPreviewColor(selectedColor ?? colors.main[0]);
setPreviewColor(selectedColor ?? colors[0]);
}}
>
{allColors.map((color) => (
Expand Down
67 changes: 24 additions & 43 deletions apps/themebuilder/app/_components/colors/colors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ export const Colors = () => {

return (
<div className={classes.rows}>
<MainColors />
<ThemeColors />
<Divider />
<NeutralColor />
<Divider />
<SupportColors />
{severityEnabled && (
<>
<Divider />
Expand All @@ -23,57 +21,40 @@ export const Colors = () => {
);
};

const MainColors = () => {
const {
colors: { main },
} = useThemebuilder();
const ThemeColors = () => {
const { colors } = useThemebuilder();

return (
<div className={classes.rows}>
{main.map((color, index) => (
<div key={index} className={classes.row}>
<div className={classes.scaleLabel}>{color.name}</div>
<Scale
colorScale={color.colors}
showHeader={index === 0}
namespace={color.name}
/>
</div>
))}
{colors
.filter((c) => c.name !== 'neutral')
.map((color, index) => (
<div key={index} className={classes.row}>
<div className={classes.scaleLabel}>{color.name}</div>
<Scale
colorScale={color.colors}
showHeader={index === 0}
namespace={color.name}
/>
</div>
))}
</div>
);
};

const NeutralColor = () => {
const {
colors: { neutral },
} = useThemebuilder();

return (
<div className={classes.rows}>
{neutral.map((color, index) => (
<div key={index} className={classes.row}>
<div className={classes.scaleLabel}>{color.name}</div>
<Scale colorScale={color.colors} namespace={color.name} />
</div>
))}
</div>
);
};

const SupportColors = () => {
const {
colors: { support },
} = useThemebuilder();
const { colors } = useThemebuilder();

return (
<div className={classes.rows}>
{support.map((color, index) => (
<div key={index} className={classes.row}>
<div className={classes.scaleLabel}>{color.name}</div>
<Scale colorScale={color.colors} namespace={color.name} />
</div>
))}
{colors
.filter((c) => c.name === 'neutral')
.map((color, index) => (
<div key={index} className={classes.row}>
<div className={classes.scaleLabel}>{color.name}</div>
<Scale colorScale={color.colors} namespace={color.name} />
</div>
))}
</div>
);
};
Expand Down
26 changes: 3 additions & 23 deletions apps/themebuilder/app/_components/config-paste/config-paste.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,9 @@ export function ConfigPaste() {
{themeName}
</Paragraph>
<div className={classes.colorPreview}>
{themeConfig.colors.main &&
Object.values(themeConfig.colors.main)
.slice(0, 3)
.map((color, idx) => (
<div
key={idx}
className={classes.colorDot}
style={{ backgroundColor: color }}
title={color}
/>
))}
{themeConfig.colors.neutral && (
<div
className={classes.colorDot}
style={{
backgroundColor: themeConfig.colors.neutral,
}}
title={themeConfig.colors.neutral}
/>
)}
{themeConfig.colors?.support &&
Object.values(themeConfig.colors.support)
.slice(0, 3)
{themeConfig.colors &&
Object.values(themeConfig.colors)
.slice(0, 7)
.map((color, idx) => (
<div
key={idx}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@ export const ExamplesComponents = ({
const ref = useRef<HTMLDivElement>(null);
const { colors } = useThemebuilder();

const neutralColor = colors?.neutral[0].hex || '#F5F7FA';
const [previewColor, setPreviewColor] = useState(
colors?.main[0].hex || color,
);
const neutralColor =
colors?.find((c) => c.name === 'neutral')?.hex || '#F5F7FA';
const [previewColor, setPreviewColor] = useState(colors?.[0]?.hex || color);

useEffect(() => {
if (ref.current) {
Expand All @@ -74,7 +73,7 @@ export const ExamplesComponents = ({

useEffect(() => {
if (!colors) return;
const allColors = [...colors.main, ...colors.support];
const allColors = colors.filter((c) => c.name !== 'neutral');
/* if select colors is gone, set to default */
if (!allColors.find((c) => c.hex === previewColor)) {
setPreviewColor(color);
Expand All @@ -97,27 +96,24 @@ export const ExamplesComponents = ({
value={previewColor}
onChange={(v) => {
if (!colors) return;
const allColors = [...colors.main, ...colors.support];
const allColors = colors.filter((c) => c.name !== 'neutral');
/* find the selected color */
let selected = allColors.find(
(c) => c.hex === v.target.value,
)?.hex;
if (!selected) {
selected = colors.main[0].hex;
selected = allColors[0]?.hex;
}
setPreviewColor(selected as CssColor);
}}
>
{colors.main.map((color) => (
<Select.Option key={color.name} value={color.hex}>
{color.name}
</Select.Option>
))}
{colors.support.map((color) => (
<Select.Option key={color.name} value={color.hex}>
{color.name}
</Select.Option>
))}
{colors
.filter((c) => c.name !== 'neutral')
.map((color) => (
<Select.Option key={color.name} value={color.hex}>
{color.name}
</Select.Option>
))}
</Select>
</Field>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,9 @@ export const ColorOverrides = ({ triggerButton }: ColorOverridesProps) => {
const { t } = useTranslation();
const dialogRef = useRef<HTMLDialogElement>(null);

const allColors: Array<{ color: ColorTheme; type: string }> = [
...colors.main.map((c) => ({ color: c, type: 'main' })),
...colors.neutral.map((c) => ({ color: c, type: 'neutral' })),
...colors.support.map((c) => ({ color: c, type: 'support' })),
...(severityEnabled
? severityColors.map((c) => ({
color: c as ColorTheme,
type: 'severity',
}))
: []),
const allColors: ColorTheme[] = [
...colors,
...(severityEnabled ? (severityColors as ColorTheme[]) : []),
];

return (
Expand All @@ -42,7 +35,7 @@ export const ColorOverrides = ({ triggerButton }: ColorOverridesProps) => {

<Dialog.Block>
<Card data-color='neutral' variant='tinted'>
{allColors.map(({ color }) => {
{allColors.map((color) => {
return <ColorDetails key={color.name} color={color} />;
})}
</Card>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
height: 44px;
}

.AddBtn {
margin-right: -8px;
}

.colors {
display: flex;
flex-wrap: wrap;
Expand Down
Loading
Loading