Skip to content

Commit

Permalink
fix(modules): add gray scheme color to module
Browse files Browse the repository at this point in the history
META DATA: @toantranmei
  • Loading branch information
toantranmei committed Apr 5, 2024
1 parent a71a95f commit 2ee8e11
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion playground/app.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default defineAppConfig({
meiUI: {
primary: "green",
primary: "purple",
gray: "cool",
},
});
File renamed without changes.
8 changes: 8 additions & 0 deletions src/runtime/mei-ui.css
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
.dark {
color-scheme: dark;
}

a:focus-visible {
@apply outline-primary;
}

::selection { @apply bg-primary/40; }
12 changes: 10 additions & 2 deletions src/runtime/plugins/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { name } from "../../../package.json";
export default defineNuxtPlugin(() => {
const appConfig = useAppConfig();
const nuxtApp = useNuxtApp();
const colors = tailwindConfig.theme.colors
const colors = tailwindConfig.theme.colors;
const root = computed(() => {
const primary: Record<string, string> | undefined =
colors[appConfig.meiUI.primary];
Expand All @@ -34,9 +34,17 @@ export default defineNuxtPlugin(() => {
.join("\n")}
--color-primary-DEFAULT: var(--color-primary-500);
${Object.entries(gray || colors.cool)
.map(
([key, value]) => `--color-gray-${key}: ${hexToRgb(value as string)};`
)
.join("\n")}
}
.dark {
--color-primary-DEFAULT: var(--color-primary-400);
}`;
}
`;
});

// Head
Expand Down

0 comments on commit 2ee8e11

Please sign in to comment.