Skip to content

Commit a0c3ad1

Browse files
committed
fix(preset-theme-default): allow overriding config like body color
1 parent 1da7fba commit a0c3ad1

File tree

4 files changed

+861
-1993
lines changed

4 files changed

+861
-1993
lines changed

packages/anu-vue/src/plugin.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const configDefaults: PluginOptions = {
3636
danger: '358.3, 100%, 64.9%',
3737
},
3838
cssVars: {
39+
'body-color': 'hsla(var(--a-base-c), 0.68)',
3940
'body-bg-c': '0,4.8%,95.9%',
4041

4142
// ℹ️ Used for background on body like select options, card, etc
@@ -52,6 +53,7 @@ const configDefaults: PluginOptions = {
5253
danger: '358.3, 73%, 64.9%',
5354
},
5455
cssVars: {
56+
'body-color': 'hsla(var(--a-base-c), 0.68)',
5557
'body-bg-c': 'var(--a-primary-hue), 15%, 5%',
5658
'surface-c': 'var(--a-primary-hue), 7%, 10%',
5759
},

packages/preset-theme-default/build.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export default defineBuildConfig({
1717
],
1818
hooks: {
1919
'mkdist:done': () => {
20-
fs.copyFileSync('src/scss/index.scss', 'dist/style.scss')
20+
// ℹ️ We no longer need to ship SCSS file
21+
// fs.copyFileSync('src/scss/index.scss', 'dist/style.scss')
2122

2223
const compiledSass = sass.compile('./src/scss/index.scss', { style: 'compressed', loadPaths: ['./node_modules/'] })
2324

packages/preset-theme-default/src/scss/index.scss

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ body {
66
text-rendering: optimizeSpeed;
77
}
88

9-
$body-color: hsla(var(--a-base-c), 0.68);
10-
$body-font-family: 'Inter', sans-serif;
11-
$header-font-family: $body-font-family;
12-
139
:root {
1410
// #region all-css-vars
1511
--a-base-c: var(--a-primary-hue), 10%, 20%;
@@ -88,12 +84,10 @@ $header-font-family: $body-font-family;
8884

8985
body {
9086
background-color: hsl(var(--a-body-bg-c));
91-
color: $body-color;
87+
color: var(--a-body-color);
9288

9389
// Disable mobile tap blue color
9490
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
95-
96-
font-family: $body-font-family;
9791
}
9892

9993
h1,
@@ -103,7 +97,6 @@ h4,
10397
h5,
10498
h6 {
10599
color: hsla(var(--a-base-c), 0.87);
106-
font-family: $header-font-family;
107100
}
108101

109102
// 👉 Misc
@@ -145,6 +138,6 @@ textarea:-webkit-autofill:focus,
145138
select:-webkit-autofill,
146139
select:-webkit-autofill:hover,
147140
select:-webkit-autofill:focus {
148-
-webkit-text-fill-color: $body-color;
141+
-webkit-text-fill-color: var(--a-body-color);
149142
transition: background-color 5000s ease-in-out 0s;
150143
}

0 commit comments

Comments
 (0)