Skip to content

Commit 152c148

Browse files
committed
refactor: use @lihbr/farben
1 parent 8dd26fe commit 152c148

File tree

7 files changed

+46
-137
lines changed

7 files changed

+46
-137
lines changed

data/colors.json

-98
Original file line numberDiff line numberDiff line change
@@ -8,103 +8,5 @@
88
"ochre": ["400", "100"],
99
"butter": ["400", "100"],
1010
"mantis": ["400", "100"]
11-
},
12-
"all": {
13-
"slate": {
14-
"900": "#131010",
15-
"800": "#1f1919",
16-
"700": "#2c2323",
17-
"600": "#3a2e2e",
18-
"500": "#493939",
19-
"400": "#594646",
20-
"300": "#6a5555",
21-
"200": "#7c6565",
22-
"100": "#8e7878",
23-
"50": "#a18e8e"
24-
},
25-
"cream": {
26-
"900": "#fffefe",
27-
"800": "#faf1f1",
28-
"700": "#f2e4e4",
29-
"600": "#e7d7d7",
30-
"500": "#dac9c9",
31-
"400": "#cdbcbc",
32-
"300": "#c0b0b0",
33-
"200": "#b4a4a4",
34-
"100": "#aa9898",
35-
"50": "#a69191"
36-
},
37-
"navy": {
38-
"900": "#373d4f",
39-
"800": "#3f4762",
40-
"700": "#445073",
41-
"600": "#485682",
42-
"500": "#4d5e8f",
43-
"400": "#54669c",
44-
"300": "#6072a9",
45-
"200": "#7182b5",
46-
"100": "#8a98c3",
47-
"50": "#adb6d1"
48-
},
49-
"beet": {
50-
"900": "#58363d",
51-
"800": "#6b3b45",
52-
"700": "#7c3e4b",
53-
"600": "#8b4051",
54-
"500": "#994456",
55-
"400": "#a54a5e",
56-
"300": "#b25569",
57-
"200": "#bf6578",
58-
"100": "#cc7e8f",
59-
"50": "#daa1ad"
60-
},
61-
"flamingo": {
62-
"900": "#a14226",
63-
"800": "#b4421f",
64-
"700": "#c44118",
65-
"600": "#d33f13",
66-
"500": "#df4010",
67-
"400": "#e84311",
68-
"300": "#f04a18",
69-
"200": "#f75726",
70-
"100": "#fc693c",
71-
"50": "#ff825c"
72-
},
73-
"ochre": {
74-
"900": "#ac621d",
75-
"800": "#bf6715",
76-
"700": "#d06b0d",
77-
"600": "#dd6e05",
78-
"500": "#e97101",
79-
"400": "#f27602",
80-
"300": "#f87d09",
81-
"200": "#fd8617",
82-
"100": "#ff922d",
83-
"50": "#ffa34c"
84-
},
85-
"butter": {
86-
"900": "#be8c21",
87-
"800": "#d19618",
88-
"700": "#e19f0f",
89-
"600": "#efa507",
90-
"500": "#f9ab03",
91-
"400": "#ffb005",
92-
"300": "#ffb310",
93-
"200": "#ffb820",
94-
"100": "#ffbf34",
95-
"50": "#ffc74d"
96-
},
97-
"mantis": {
98-
"900": "#435138",
99-
"800": "#50643f",
100-
"700": "#5a7544",
101-
"600": "#638448",
102-
"500": "#6c924c",
103-
"400": "#759f53",
104-
"300": "#81ab5f",
105-
"200": "#90b870",
106-
"100": "#a4c589",
107-
"50": "#bed3ac"
108-
}
10911
}
11012
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
},
3434
"dependencies": {
3535
"@11ty/eleventy-fetch": "4.0.1",
36+
"@lihbr/farben": "0.0.1",
3637
"@prismicio/client": "7.12.0",
3738
"@wooorm/starry-night": "3.5.0",
3839
"cookie-es": "1.2.2",

pnpm-lock.yaml

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/akte/types.ts

-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ export type Colors = (typeof Color)[keyof typeof Color]
7777

7878
export type ColorsData = {
7979
primary: Record<Colors, Shades[]>
80-
all: Record<Colors, Record<Shades, string>>
8180
}
8281

8382
export type DiscogsRelease = {

src/files/colors.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { ColorsData, GlobalData } from "../akte/types"
22

3+
import { farben } from "@lihbr/farben"
34
import { defineAkteFile } from "akte"
45
import { readDataJSON } from "../akte/data"
56
import { getPrettyContrastRatio } from "../akte/getPrettyContrastRatio"
@@ -11,9 +12,9 @@ import { page } from "../layouts/page"
1112
export const colors = defineAkteFile<GlobalData>().from({
1213
path: "/colors",
1314
async data() {
14-
const colors = await readDataJSON<ColorsData>("colors.json")
15+
const { primary } = await readDataJSON<ColorsData>("colors.json")
1516

16-
return { colors }
17+
return { colors: { primary, all: farben } }
1718
},
1819
render(context) {
1920
const hero = /* html */ `

tailwind.config.cjs

+33-36
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
const process = require("node:process")
2-
3-
function alpha(hexa, alpha = 1) {
4-
return `${hexa}${`0${Number(Math.round(255 * alpha)).toString(16)}`.slice(-2)}`
5-
}
2+
const { farben, alpha } = require("@lihbr/farben")
63

74
const content = ["./src/**/*.ts"]
85

@@ -54,53 +51,53 @@ module.exports = {
5451
"100": "var(--color-theme-100)",
5552
},
5653
slate: {
57-
"DEFAULT": "#1f1919", // 800
58-
"o-20": alpha("#1f1919", 0.2),
59-
"900": "#131010",
60-
"700": "#2c2323",
61-
"200": "#7c6565",
62-
"100": "#8e7878",
63-
"50": "#a18e8e",
54+
"DEFAULT": farben.slate[800], // 800
55+
"o-20": alpha(farben.slate[800], 0.2),
56+
"900": farben.slate[900],
57+
"700": farben.slate[700],
58+
"200": farben.slate[200],
59+
"100": farben.slate[100],
60+
"50": farben.slate[50],
6461
},
6562
cream: {
66-
"DEFAULT": "#faf1f1", // 800
67-
"o-20": alpha("#faf1f1", 0.2),
68-
"900": "#fffefe",
69-
"700": "#f2e4e4",
70-
"200": "#b4a4a4",
71-
"100": "#ab9a9a",
72-
"50": "#a69191",
63+
"DEFAULT": farben.cream[800], // 800
64+
"o-20": alpha(farben.cream[800], 0.2),
65+
"900": farben.cream[900],
66+
"700": farben.cream[700],
67+
"200": farben.cream[200],
68+
"100": farben.cream[100],
69+
"50": farben.cream[50],
7370
},
7471
// o-20 used for tap highlight and inline code only
7572
navy: {
76-
"DEFAULT": "#54669c",
77-
"o-20": alpha("#54669c", 0.2),
78-
"100": "#8a98c3",
73+
"DEFAULT": farben.navy[400],
74+
"o-20": alpha(farben.navy[400], 0.2),
75+
"100": farben.navy[100],
7976
},
8077
beet: {
81-
"DEFAULT": "#a54a5e",
82-
"o-20": alpha("#a54a5e", 0.2),
83-
"100": "#cc7e8f",
78+
"DEFAULT": farben.beet[400],
79+
"o-20": alpha(farben.beet[400], 0.2),
80+
"100": farben.beet[100],
8481
},
8582
flamingo: {
86-
"DEFAULT": "#e84311",
87-
"o-20": alpha("#e84311", 0.2),
88-
"100": "#fc693c",
83+
"DEFAULT": farben.flamingo[400],
84+
"o-20": alpha(farben.flamingo[400], 0.2),
85+
"100": farben.flamingo[100],
8986
},
9087
ochre: {
91-
"DEFAULT": "#f27502",
92-
"o-20": alpha("#f27502", 0.2),
93-
"100": "#ff922d",
88+
"DEFAULT": farben.ochre[400],
89+
"o-20": alpha(farben.ochre[400], 0.2),
90+
"100": farben.ochre[100],
9491
},
9592
butter: {
96-
"DEFAULT": "#ffb005",
97-
"o-20": alpha("#ffb005", 0.2),
98-
"100": "#ffbf34",
93+
"DEFAULT": farben.butter[400],
94+
"o-20": alpha(farben.butter[400], 0.2),
95+
"100": farben.butter[100],
9996
},
10097
mantis: {
101-
"DEFAULT": "#759f53",
102-
"o-20": alpha("#759f53", 0.2),
103-
"100": "#a4c589",
98+
"DEFAULT": farben.mantis[400],
99+
"o-20": alpha(farben.mantis[400], 0.2),
100+
"100": farben.mantis[100],
104101
},
105102
},
106103
extend: {

vite.config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as path from "node:path"
33
import akte from "akte/vite"
44
import getPort from "get-port"
55
import { listenAndWatch } from "listhen"
6+
67
import { defineConfig } from "vite"
78

89
import { app } from "./src/akte.app"

0 commit comments

Comments
 (0)