bref-ui-themes 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -1
- package/dist/crystal-code/theme.svelte +5 -22
- package/dist/crystal-code/theme.svelte.d.ts +2 -5
- package/dist/glassy/theme.svelte +5 -4
- package/dist/glassy/theme.svelte.d.ts +2 -5
- package/dist/new-paris/theme.svelte +5 -4
- package/dist/new-paris/theme.svelte.d.ts +2 -5
- package/dist/vscode/theme.svelte +5 -4
- package/dist/vscode/theme.svelte.d.ts +2 -5
- package/package.json +2 -2
- package/src/lib/crystal-code/theme.svelte +5 -22
- package/src/lib/glassy/theme.svelte +5 -4
- package/src/lib/new-paris/theme.svelte +5 -4
- package/src/lib/vscode/theme.svelte +5 -4
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Explore the [theme galleries](https://feuersteiner.github.io/bref-ui/themes) for
|
|
|
12
12
|
component examples and interaction states, or browse the
|
|
13
13
|
[Bref-ui documentation](https://feuersteiner.github.io/bref-ui/).
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
https://github.com/user-attachments/assets/b2a0cff0-5d34-4f5b-bbdb-0233e0fef81e
|
|
16
16
|
|
|
17
17
|
See New Paris shopping, the ADE workbench with VS Code styling and a Glassy
|
|
18
18
|
workspace in action. The [video app and storyboard](https://github.com/feuersteiner/bref-ui/tree/main/video-demo#readme)
|
|
@@ -50,6 +50,38 @@ Import components from the theme's entry point:
|
|
|
50
50
|
<Theme><Button label="Save" /></Theme>
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
## Theme controls
|
|
54
|
+
|
|
55
|
+
Every prebuilt `Theme` accepts the core `ThemeProps` from `bref-ui/types`:
|
|
56
|
+
optional `children?: Snippet` and `palette?: Palette | { light: Palette; dark: Palette }`.
|
|
57
|
+
`Palette` is a partial map of semantic colors to CSS hex values: `primary`,
|
|
58
|
+
`secondary`, `background`, `foreground`, `muted`, `info`, `success`, `warning`, `error`.
|
|
59
|
+
Invalid hex values throw, as in core Theme.
|
|
60
|
+
|
|
61
|
+
```svelte
|
|
62
|
+
<script lang="ts">
|
|
63
|
+
import { Theme as CrystalCodeTheme, Button } from 'bref-ui-themes/crystal-code';
|
|
64
|
+
import type { Palette } from 'bref-ui/types';
|
|
65
|
+
|
|
66
|
+
const palette = { primary: '#6750a4' } satisfies Palette;
|
|
67
|
+
</script>
|
|
68
|
+
|
|
69
|
+
<CrystalCodeTheme {palette}><Button label="Save" /></CrystalCodeTheme>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
A shared palette applies to both modes. For separate overrides, pass
|
|
73
|
+
`palette={{ light: { primary: '#6750a4' }, dark: { primary: '#d0bcff' } }}`.
|
|
74
|
+
Each mode merges only its supplied colors with that theme's defaults. Omitted
|
|
75
|
+
colors retain the original appearance; private material and typography tokens
|
|
76
|
+
remain theme-specific. Check contrast when choosing custom colors. Overrides stay on the instance, including nested themes,
|
|
77
|
+
and do not alter sibling themes or core Theme.
|
|
78
|
+
|
|
79
|
+
Use `ThemeModeToggle` to select `light`, `dark` or `auto` through the existing
|
|
80
|
+
color-scheme metadata. Local `[data-theme="light"]`, `[data-theme="dark"]` and
|
|
81
|
+
`[data-theme="auto"]` containers select the mode for their nested prebuilt themes;
|
|
82
|
+
the nearest container wins. Without a mode selection, Crystal Code follows the
|
|
83
|
+
system, New Paris and Glassy stay light, and VS Code stays dark.
|
|
84
|
+
|
|
53
85
|
## Development
|
|
54
86
|
|
|
55
87
|
Run `bun install` and `bun run dev` from the repository root. The docs site consumes
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
3
|
+
import { paletteStyle } from 'bref-ui';
|
|
3
4
|
import './theme/fonts.css';
|
|
4
5
|
|
|
5
|
-
let { children
|
|
6
|
+
let { children, palette = {} }: ThemeProps = $props();
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
|
-
<div data-bref-theme="crystal-code">{@render children?.()}</div>
|
|
9
|
+
<div data-bref-theme="crystal-code" style={paletteStyle(palette)}>{@render children?.()}</div>
|
|
9
10
|
|
|
10
11
|
<style>
|
|
11
12
|
[data-bref-theme] {
|
|
12
|
-
color-scheme: light dark;
|
|
13
|
+
color-scheme: var(--bref-theme-mode, light dark);
|
|
13
14
|
--color-primary-light: #4e5969;
|
|
14
15
|
--color-primary-dark: #8aa7f8;
|
|
15
16
|
--color-primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
|
|
@@ -70,22 +71,4 @@
|
|
|
70
71
|
color: var(--color-foreground);
|
|
71
72
|
font-synthesis: none;
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
:global(:where(:root:has(meta[name='color-scheme'][content='light']))) [data-bref-theme] {
|
|
75
|
-
color-scheme: light;
|
|
76
|
-
}
|
|
77
|
-
:global(:where(:root:has(meta[name='color-scheme'][content='dark']))) [data-bref-theme] {
|
|
78
|
-
color-scheme: dark;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@scope ([data-theme='light']) {
|
|
82
|
-
[data-bref-theme] {
|
|
83
|
-
color-scheme: light;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
@scope ([data-theme='dark']) {
|
|
87
|
-
[data-bref-theme] {
|
|
88
|
-
color-scheme: dark;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
74
|
</style>
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
2
2
|
import './theme/fonts.css';
|
|
3
|
-
|
|
4
|
-
children?: Snippet;
|
|
5
|
-
};
|
|
6
|
-
declare const Theme: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
|
+
declare const Theme: import("svelte").Component<ThemeProps, {}, "">;
|
|
7
4
|
type Theme = ReturnType<typeof Theme>;
|
|
8
5
|
export default Theme;
|
package/dist/glassy/theme.svelte
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
3
|
+
import { paletteStyle } from 'bref-ui';
|
|
3
4
|
import './theme/fonts.css';
|
|
4
|
-
let { children
|
|
5
|
+
let { children, palette = {} }: ThemeProps = $props();
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
|
-
<div data-bref-theme="glassy">{@render children?.()}</div>
|
|
8
|
+
<div data-bref-theme="glassy" style={paletteStyle(palette)}>{@render children?.()}</div>
|
|
8
9
|
|
|
9
10
|
<style>
|
|
10
11
|
[data-bref-theme] {
|
|
11
|
-
color-scheme: light;
|
|
12
|
+
color-scheme: var(--bref-theme-mode, light);
|
|
12
13
|
--color-primary-light: #0068d9;
|
|
13
14
|
--color-primary-dark: #0068d9;
|
|
14
15
|
--color-primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
2
2
|
import './theme/fonts.css';
|
|
3
|
-
|
|
4
|
-
children?: Snippet;
|
|
5
|
-
};
|
|
6
|
-
declare const Theme: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
|
+
declare const Theme: import("svelte").Component<ThemeProps, {}, "">;
|
|
7
4
|
type Theme = ReturnType<typeof Theme>;
|
|
8
5
|
export default Theme;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import '@fontsource-variable/material-symbols-outlined/fill.css';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
4
|
+
import { paletteStyle } from 'bref-ui';
|
|
5
|
+
let { children, palette = {} }: ThemeProps = $props();
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
|
-
<div data-bref-theme="new-paris">{@render children?.()}</div>
|
|
8
|
+
<div data-bref-theme="new-paris" style={paletteStyle(palette)}>{@render children?.()}</div>
|
|
8
9
|
|
|
9
10
|
<style>
|
|
10
11
|
[data-bref-theme] {
|
|
11
|
-
color-scheme: light;
|
|
12
|
+
color-scheme: var(--bref-theme-mode, light);
|
|
12
13
|
--color-primary-light: #171715;
|
|
13
14
|
--color-primary-dark: #171715;
|
|
14
15
|
--color-primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import '@fontsource-variable/material-symbols-outlined/fill.css';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
children?: Snippet;
|
|
5
|
-
};
|
|
6
|
-
declare const Theme: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
2
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
3
|
+
declare const Theme: import("svelte").Component<ThemeProps, {}, "">;
|
|
7
4
|
type Theme = ReturnType<typeof Theme>;
|
|
8
5
|
export default Theme;
|
package/dist/vscode/theme.svelte
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
3
|
+
import { paletteStyle } from 'bref-ui';
|
|
3
4
|
import './theme/fonts.css';
|
|
4
5
|
|
|
5
|
-
let { children
|
|
6
|
+
let { children, palette = {} }: ThemeProps = $props();
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
|
-
<div data-bref-theme="vscode">{@render children?.()}</div>
|
|
9
|
+
<div data-bref-theme="vscode" style={paletteStyle(palette)}>{@render children?.()}</div>
|
|
9
10
|
|
|
10
11
|
<style>
|
|
11
12
|
[data-bref-theme] {
|
|
12
|
-
color-scheme: dark;
|
|
13
|
+
color-scheme: var(--bref-theme-mode, dark);
|
|
13
14
|
--color-primary-light: #3794ff;
|
|
14
15
|
--color-primary-dark: #3794ff;
|
|
15
16
|
--color-primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
2
2
|
import './theme/fonts.css';
|
|
3
|
-
|
|
4
|
-
children?: Snippet;
|
|
5
|
-
};
|
|
6
|
-
declare const Theme: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
3
|
+
declare const Theme: import("svelte").Component<ThemeProps, {}, "">;
|
|
7
4
|
type Theme = ReturnType<typeof Theme>;
|
|
8
5
|
export default Theme;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bref-ui-themes",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "vite dev",
|
|
6
6
|
"build": "vite build && npm run prepack",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@fontsource-variable/material-symbols-outlined": "^5.3.5"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"bref-ui": "^3.
|
|
38
|
+
"bref-ui": "^3.1.1",
|
|
39
39
|
"svelte": "^5.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
3
|
+
import { paletteStyle } from 'bref-ui';
|
|
3
4
|
import './theme/fonts.css';
|
|
4
5
|
|
|
5
|
-
let { children
|
|
6
|
+
let { children, palette = {} }: ThemeProps = $props();
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
|
-
<div data-bref-theme="crystal-code">{@render children?.()}</div>
|
|
9
|
+
<div data-bref-theme="crystal-code" style={paletteStyle(palette)}>{@render children?.()}</div>
|
|
9
10
|
|
|
10
11
|
<style>
|
|
11
12
|
[data-bref-theme] {
|
|
12
|
-
color-scheme: light dark;
|
|
13
|
+
color-scheme: var(--bref-theme-mode, light dark);
|
|
13
14
|
--color-primary-light: #4e5969;
|
|
14
15
|
--color-primary-dark: #8aa7f8;
|
|
15
16
|
--color-primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
|
|
@@ -70,22 +71,4 @@
|
|
|
70
71
|
color: var(--color-foreground);
|
|
71
72
|
font-synthesis: none;
|
|
72
73
|
}
|
|
73
|
-
|
|
74
|
-
:global(:where(:root:has(meta[name='color-scheme'][content='light']))) [data-bref-theme] {
|
|
75
|
-
color-scheme: light;
|
|
76
|
-
}
|
|
77
|
-
:global(:where(:root:has(meta[name='color-scheme'][content='dark']))) [data-bref-theme] {
|
|
78
|
-
color-scheme: dark;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@scope ([data-theme='light']) {
|
|
82
|
-
[data-bref-theme] {
|
|
83
|
-
color-scheme: light;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
@scope ([data-theme='dark']) {
|
|
87
|
-
[data-bref-theme] {
|
|
88
|
-
color-scheme: dark;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
74
|
</style>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
3
|
+
import { paletteStyle } from 'bref-ui';
|
|
3
4
|
import './theme/fonts.css';
|
|
4
|
-
let { children
|
|
5
|
+
let { children, palette = {} }: ThemeProps = $props();
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
|
-
<div data-bref-theme="glassy">{@render children?.()}</div>
|
|
8
|
+
<div data-bref-theme="glassy" style={paletteStyle(palette)}>{@render children?.()}</div>
|
|
8
9
|
|
|
9
10
|
<style>
|
|
10
11
|
[data-bref-theme] {
|
|
11
|
-
color-scheme: light;
|
|
12
|
+
color-scheme: var(--bref-theme-mode, light);
|
|
12
13
|
--color-primary-light: #0068d9;
|
|
13
14
|
--color-primary-dark: #0068d9;
|
|
14
15
|
--color-primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import '@fontsource-variable/material-symbols-outlined/fill.css';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
4
|
+
import { paletteStyle } from 'bref-ui';
|
|
5
|
+
let { children, palette = {} }: ThemeProps = $props();
|
|
5
6
|
</script>
|
|
6
7
|
|
|
7
|
-
<div data-bref-theme="new-paris">{@render children?.()}</div>
|
|
8
|
+
<div data-bref-theme="new-paris" style={paletteStyle(palette)}>{@render children?.()}</div>
|
|
8
9
|
|
|
9
10
|
<style>
|
|
10
11
|
[data-bref-theme] {
|
|
11
|
-
color-scheme: light;
|
|
12
|
+
color-scheme: var(--bref-theme-mode, light);
|
|
12
13
|
--color-primary-light: #171715;
|
|
13
14
|
--color-primary-dark: #171715;
|
|
14
15
|
--color-primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { ThemeProps } from 'bref-ui/types';
|
|
3
|
+
import { paletteStyle } from 'bref-ui';
|
|
3
4
|
import './theme/fonts.css';
|
|
4
5
|
|
|
5
|
-
let { children
|
|
6
|
+
let { children, palette = {} }: ThemeProps = $props();
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
|
-
<div data-bref-theme="vscode">{@render children?.()}</div>
|
|
9
|
+
<div data-bref-theme="vscode" style={paletteStyle(palette)}>{@render children?.()}</div>
|
|
9
10
|
|
|
10
11
|
<style>
|
|
11
12
|
[data-bref-theme] {
|
|
12
|
-
color-scheme: dark;
|
|
13
|
+
color-scheme: var(--bref-theme-mode, dark);
|
|
13
14
|
--color-primary-light: #3794ff;
|
|
14
15
|
--color-primary-dark: #3794ff;
|
|
15
16
|
--color-primary: light-dark(var(--color-primary-light), var(--color-primary-dark));
|