Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Comeza committed Jun 12, 2024
1 parent 51b49fc commit 2cdec7d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions liberica/src/lib/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface HSL {
l: number;
}

export function HexToRGB(hex: string): RGB {
export function hexToRGB(hex: string): RGB {
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);

if (!result) {
Expand All @@ -27,8 +27,8 @@ export function HexToRGB(hex: string): RGB {
return { r, g, b };
}

export function HexToHSL(hex: string): HSL {
const { r, g, b } = HexToRGB(hex);
export function hexToHSL(hex: string): HSL {
const { r, g, b } = hexToRGB(hex);

const max = Math.max(r, g, b);
const min = Math.min(r, g, b);
Expand Down
6 changes: 3 additions & 3 deletions liberica/src/lib/theme.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import THEMES_JSON from "assets/themes.json";
import { HexToHSL } from "lib/colors";
import { hexToHSL } from "lib/colors";
import { fromCamelToKebabCase } from "lib/util";

export const THEMES: Record<string, Theme> = THEMES_JSON;
Expand Down Expand Up @@ -33,8 +33,8 @@ export function applyTheme(theme: Theme) {
console.log(name, "links to " + link + " --> " + color);
}

const { h, s, l } = HexToHSL(color);
const hsl = `${h.toString()} ${s.toString()}% ${l.toString()}%`;
const { h, s, l } = hexToHSL(color);
const hsl = `${h} ${s}% ${l}%`;

console.log(name, fromCamelToKebabCase(name));
style.setProperty("--color-" + fromCamelToKebabCase(name), hsl);
Expand Down
2 changes: 1 addition & 1 deletion liberica/src/lib/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ export const clamp = (x: number, min: number, max: number) => {
return Math.min(Math.max(x, min), max);
};

export const fromCamelToKebabCase = (input: string) =>
export const camelToKebabCase = (input: string) =>
input.replace(/[A-Z]/g, (letter) => "-" + letter.toLowerCase());
2 changes: 1 addition & 1 deletion liberica/src/page/CreateTeam.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function CreateTeam() {

<TextInput
onChange={(e) => setName(e.target.value)}
placeholder="Lila pause"
placeholder="Lila Pause"
/>

<DropDown<TeamKind>
Expand Down

0 comments on commit 2cdec7d

Please sign in to comment.