Skip to content

Commit

Permalink
feat: add stylize colors
Browse files Browse the repository at this point in the history
  • Loading branch information
xinyao27 committed May 17, 2024
1 parent 2fb74d7 commit 29dbfcd
Show file tree
Hide file tree
Showing 4 changed files with 448 additions and 13 deletions.
19 changes: 19 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,22 @@ export const bgBlueBright = format(...theme.bgBlueBright)
export const bgMagentaBright = format(...theme.bgMagentaBright)
export const bgCyanBright = format(...theme.bgCyanBright)
export const bgWhiteBright = format(...theme.bgWhiteBright)

export const blackStylize = hex(theme.blackStylize[0])
export const blackSecondaryStylize = hex(theme.blackStylize[1])
export const redStylize = hex(theme.redStylize[0])
export const redSecondaryStylize = hex(theme.redStylize[1])
export const greenStylize = hex(theme.greenStylize[0])
export const greenSecondaryStylize = hex(theme.greenStylize[1])
export const yellowStylize = hex(theme.yellowStylize[0])
export const yellowSecondaryStylize = hex(theme.yellowStylize[1])
export const blueStylize = hex(theme.blueStylize[0])
export const blueSecondaryStylize = hex(theme.blueStylize[1])
export const magentaStylize = hex(theme.magentaStylize[0])
export const magentaSecondaryStylize = hex(theme.magentaStylize[1])
export const cyanStylize = hex(theme.cyanStylize[0])
export const cyanSecondaryStylize = hex(theme.cyanStylize[1])
export const whiteStylize = hex(theme.whiteStylize[0])
export const whiteSecondaryStylize = hex(theme.whiteStylize[1])
export const grayStylize = hex(theme.grayStylize[0])
export const graySecondaryStylize = hex(theme.grayStylize[1])
14 changes: 12 additions & 2 deletions src/theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const theme: Record<string, [number, number]> = {
export const theme = {
reset: [0, 0],
bold: [1, 22],
dim: [2, 22],
Expand Down Expand Up @@ -44,4 +44,14 @@ export const theme: Record<string, [number, number]> = {
bgMagentaBright: [105, 49],
bgCyanBright: [106, 49],
bgWhiteBright: [107, 49],
}

blackStylize: ['#121212', '#eeeeee18'],
redStylize: ['#cb7676', '#ab5959'],
greenStylize: ['#4d9375', '#1e754f'],
yellowStylize: ['#e6cc77', '#bda437'],
blueStylize: ['#6394bf', '#296aa3'],
magentaStylize: ['#c391e6', '#c391e690'],
cyanStylize: ['#5eaab5', '#2993a3'],
whiteStylize: ['#ffffff', '#ffffff9f'],
grayStylize: ['#888888', '#444444'],
} as const
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ export const hexToRgb = (value: string) => {

const num = Number.parseInt(color, 16)

return [(num >> 16) & 255, (num >> 8) & 255, num & 255]
return [(num >> 16) & 255, (num >> 8) & 255, num & 255] as const
}
Loading

0 comments on commit 29dbfcd

Please sign in to comment.