Skip to content

Commit

Permalink
chore: fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
chizukicn committed Oct 25, 2023
1 parent 3e586e3 commit 2b95fdc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ export default defineConfig({
```css
.text-primary\/72 {
// hsla
color: hsla(var(--un-platte-primary-color-hsl) / 0.72);
color: hsla(var(--un-palette-primary-color-hsl) / 0.72);
// rgba
// color: rgba(var(--un-platte-primary-color-rgb) / 0.72);
// color: rgba(var(--un-palette-primary-color-rgb) / 0.72);
}

.bg-primary\/36 {
// hsla
background-color: hsla(var(--un-platte-primary-color-hsl) / 0.36);
background-color: hsla(var(--un-palette-primary-color-hsl) / 0.36);
// rgba
// background-color: rgba(var(--un-platte-primary-color-rgb) / 0.36);
// background-color: rgba(var(--un-palette-primary-color-rgb) / 0.36);
}

```
Expand Down Expand Up @@ -103,7 +103,7 @@ export interface PaletteOptions {
}

/**
* @default --un-platte-[name]-color
* @default --un-palette-[name]-color
*/
cssVarName?: CssVarName

Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const presetPalette = definePreset((options: PaletteOptions = {}) => {

const { selector = ":root", attribute = "class", defaultValue = "default" } = colorMode;

const cssVarName: CssVarName = options.cssVarName || "un-platte-[name]-color";
const cssVarName: CssVarName = options.cssVarName || "un-palette-[name]-color";

const colorComponents = getColorComponents(themeColors, defaultValue, colorFormat);

Expand All @@ -28,7 +28,7 @@ export const presetPalette = definePreset((options: PaletteOptions = {}) => {
} else if (typeof cssVarName === "function") {
getVarName = name => normalizeVarName(cssVarName(name));
} else {
const prefix = cssVarName?.prefix ?? "un-platte-";
const prefix = cssVarName?.prefix ?? "un-palette-";
const suffix = cssVarName?.suffix ?? "-color";
getVarName = name => normalizeVarName(`${prefix}${name}${suffix}`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export interface PaletteOptions {
}

/**
* @default --un-platte-[name]-color
* @default --un-palette-[name]-color
*/
cssVarName?: CssVarName

Expand Down
4 changes: 2 additions & 2 deletions test/generate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("generate test", () => {
const { css } = await uno.generate("bg-primary");
expect(css).toMatchInlineSnapshot(`
"/* layer: palette */
:root{--un-platte-primary-color-rgb:255 0 0;--un-platte-primary-color:rgb(var(--un-platte-primary-color-rgb));}"
:root{--un-palette-primary-color-rgb:255 0 0;--un-palette-primary-color:rgb(var(--un-palette-primary-color-rgb));}"
`);
});

Expand All @@ -35,7 +35,7 @@ describe("generate test", () => {
});
expect(css).toMatchInlineSnapshot(`
"/* layer: default */
.bg-primary{--un-bg-opacity:1;background-color:rgb(var(--un-platte-primary-color-rgb) / var(--un-bg-opacity));}"
.bg-primary{--un-bg-opacity:1;background-color:rgb(var(--un-palette-primary-color-rgb) / var(--un-bg-opacity));}"
`);
});
});
4 changes: 2 additions & 2 deletions test/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe("utils test", () => {
});

it("normalizeVarName", () => {
expect(normalizeVarName("un-platte-primary-color")).toEqual("--un-platte-primary-color");
expect(normalizeVarName("--un-platte-primary-color")).toEqual("--un-platte-primary-color");
expect(normalizeVarName("un-palette-primary-color")).toEqual("--un-palette-primary-color");
expect(normalizeVarName("--un-palette-primary-color")).toEqual("--un-palette-primary-color");
});
});

0 comments on commit 2b95fdc

Please sign in to comment.