Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(themes): add theme generator #3707

Open
wants to merge 15 commits into
base: canary
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
fix: types in themes colors
  • Loading branch information
xylish7 committed Sep 3, 2024
commit 83538fe6ea319bb1771e71154cde8515641e3fe1
2 changes: 1 addition & 1 deletion apps/docs/components/themes/utils/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export function hexToHsl(hex: string) {
hue *= 60;
if (hue < 0) hue += 360;

return `${hue} ${(saturation * 100).toFixed(2)}% ${(lightness * 100).toFixed(2)}%`;
return `${hue.toFixed(2)} ${(saturation * 100).toFixed(2)}% ${(lightness * 100).toFixed(2)}%`;
}

/**
Expand Down
26 changes: 13 additions & 13 deletions apps/docs/components/themes/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {NextUIPluginConfig} from "@nextui-org/theme";
import {readableColor} from "color2k";

import {Config} from "../types";
import {defaultDarkColorWeight, defaultLightColorWeight} from "../constants";
import {colorWeight, defaultDarkColorWeight, defaultLightColorWeight} from "../constants";

import {generateThemeColor} from "./colors";

Expand Down Expand Up @@ -47,13 +47,13 @@ export function generatePluginConfig(config: Config): NextUIPluginConfig {
"light",
defaultLightColorWeight,
),
primary: generateThemeColor(config.light.brandColor.primary, "light"),
secondary: generateThemeColor(config.light.brandColor.secondary, "light"),
success: generateThemeColor(config.light.brandColor.success, "light"),
warning: generateThemeColor(config.light.brandColor.warning, "light"),
danger: generateThemeColor(config.light.brandColor.danger, "light"),
primary: generateThemeColor(config.light.brandColor.primary, "light", colorWeight),
secondary: generateThemeColor(config.light.brandColor.secondary, "light", colorWeight),
success: generateThemeColor(config.light.brandColor.success, "light", colorWeight),
warning: generateThemeColor(config.light.brandColor.warning, "light", colorWeight),
danger: generateThemeColor(config.light.brandColor.danger, "light", colorWeight),
background: config.light.baseColor.background,
foreground: generateThemeColor(config.light.baseColor.foreground, "light"),
foreground: generateThemeColor(config.light.baseColor.foreground, "light", colorWeight),
content1: {
DEFAULT: config.light.baseColor.content1,
foreground: readableColor(config.light.baseColor.content1),
Expand Down Expand Up @@ -82,13 +82,13 @@ export function generatePluginConfig(config: Config): NextUIPluginConfig {
"dark",
defaultDarkColorWeight,
),
primary: generateThemeColor(config.dark.brandColor.primary, "dark"),
secondary: generateThemeColor(config.dark.brandColor.secondary, "dark"),
success: generateThemeColor(config.dark.brandColor.success, "dark"),
warning: generateThemeColor(config.dark.brandColor.warning, "dark"),
danger: generateThemeColor(config.dark.brandColor.danger, "dark"),
primary: generateThemeColor(config.dark.brandColor.primary, "dark", colorWeight),
secondary: generateThemeColor(config.dark.brandColor.secondary, "dark", colorWeight),
success: generateThemeColor(config.dark.brandColor.success, "dark", colorWeight),
warning: generateThemeColor(config.dark.brandColor.warning, "dark", colorWeight),
danger: generateThemeColor(config.dark.brandColor.danger, "dark", colorWeight),
background: config.dark.baseColor.background,
foreground: generateThemeColor(config.dark.baseColor.foreground, "dark"),
foreground: generateThemeColor(config.dark.baseColor.foreground, "dark", colorWeight),
content1: {
DEFAULT: config.dark.baseColor.content1,
foreground: readableColor(config.dark.baseColor.content1),
Expand Down