-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
215 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
{ | ||
"Rosé Pine Dawn": { | ||
"base": "#faf4ed", | ||
"surface": "#fffaf3", | ||
"muted": "#9893a5", | ||
"primary": "#d7827e", | ||
"secondary": "#286983", | ||
|
||
"onBase": "#575279", | ||
"onSurface": "@onBase", | ||
"onMuted": "@onBase", | ||
"onPrimary": "@base", | ||
"onSecondary": "@base" | ||
}, | ||
"Rosé Pine": { | ||
"base": "#faf4ed", | ||
"surface": "#fffaf3", | ||
"muted": "#9893a5", | ||
"text": "#575279", | ||
"primary": "#d7827e", | ||
"secondary": "#286983", | ||
"accent": "#ea9d34" | ||
"base": "#191724", | ||
"surface": "#1f1d2e", | ||
"muted": "#6e6a86", | ||
"primary": "#ebbcba", | ||
"secondary": "#31748f", | ||
|
||
"onBase": "#e0def4", | ||
"onSurface": "@onBase", | ||
"onMuted": "@onBase", | ||
"onPrimary": "@base", | ||
"onSecondary": "@base" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Button } from "./button"; | ||
import { TextInput } from "./input.tsx"; | ||
|
||
export function classes(...inputs: string[]): string { | ||
return inputs.join(" "); | ||
} | ||
|
||
export { Button, TextInput }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export type TextInputProps = Omit< | ||
React.ComponentProps<"input">, | ||
"className" | "type" | ||
>; | ||
|
||
export function TextInput(props: TextInputProps) { | ||
return ( | ||
<input | ||
{...props} | ||
type="text" | ||
className="text-text rounded-xl bg-muted/20 px-6 py-3 outline-none ring-muted focus:ring-2" | ||
> | ||
{props.children} | ||
</input> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export type SelectProps = Omit<React.ComponentProps<"select">, "className">; | ||
|
||
export function Select(props: SelectProps) { | ||
return ( | ||
<select className="text-text rounded-xl bg-muted/20 px-6 py-3"> | ||
{props.children} | ||
</select> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,42 @@ | ||
import THEMES_JSON from "assets/themes.json"; | ||
import { HexToHSL } from "lib/colors"; | ||
import { fromCamelToKebabCase } from "lib/util"; | ||
|
||
export const THEMES: Record<string, Theme> = THEMES_JSON; | ||
|
||
export interface Theme { | ||
base: string; | ||
surface: string; | ||
text: string; | ||
muted: string; | ||
primary: string; | ||
secondary: string; | ||
accent: string; | ||
|
||
onBase: string; | ||
onSurface: string; | ||
onPrimary: string; | ||
onSecondary: string; | ||
onMuted: string; | ||
} | ||
|
||
export function applyTheme(theme: Theme) { | ||
const style = document.documentElement.style; | ||
for (const [name, color] of Object.entries(theme)) { | ||
const { h, s, l } = HexToHSL(color as string); | ||
style.setProperty( | ||
`--color-${name}`, | ||
`${h.toString()} ${s.toString()}% ${l.toString()}%`, | ||
); | ||
|
||
for (const [name, val] of Object.entries(theme) as [ | ||
keyof Theme, | ||
string, | ||
][]) { | ||
let color = val; | ||
|
||
if (val.startsWith("@")) { | ||
const link = val.substring(1) as keyof Theme; | ||
color = theme[link]; | ||
console.log(name, "links to " + link + " --> " + color); | ||
} | ||
|
||
const { h, s, l } = HexToHSL(color); | ||
const hsl = `${h.toString()} ${s.toString()}% ${l.toString()}%`; | ||
|
||
console.log(name, fromCamelToKebabCase(name)); | ||
style.setProperty("--color-" + fromCamelToKebabCase(name), hsl); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.