From b10c13285736257d5896d59afcbba507969eaeb8 Mon Sep 17 00:00:00 2001 From: Ava Gaiety W Date: Fri, 19 Sep 2025 22:00:46 -0600 Subject: [PATCH] refactor --- index.ts | 5 +- ports/kitty/dist/kitty.conf | 2 +- ports/kitty/src/build.ts | 136 +----------------------------------- ports/kitty/src/data.ts | 136 ++++++++++++++++++++++++++++++++++++ 4 files changed, 141 insertions(+), 138 deletions(-) create mode 100644 ports/kitty/src/data.ts diff --git a/index.ts b/index.ts index 663e327..4b52e48 100644 --- a/index.ts +++ b/index.ts @@ -1,10 +1,10 @@ #!/usr/bin/env node import { Command } from 'commander' +import { timerToSeconds } from './src/helpers/math'; import previewList from './src/preview/cli-list' import previewSnippet from './src/preview/cli-snippet' import buildTOML from './src/build/toml' -import { nanoseconds } from 'bun'; -import { timerToSeconds } from './src/helpers/math'; +import buildKitty from './ports/kitty/src/build' const program = new Command(); @@ -43,6 +43,7 @@ program log(options.verbose, await buildTOML(), timer) if (options.verbose) console.info('Building Ports...') + log(options.verbose, await buildKitty(), timer) }); program.parse(); diff --git a/ports/kitty/dist/kitty.conf b/ports/kitty/dist/kitty.conf index 4a3193b..fd13c73 100644 --- a/ports/kitty/dist/kitty.conf +++ b/ports/kitty/dist/kitty.conf @@ -17,7 +17,7 @@ selection_background #C6E4F0 # Cursor colors cursor #C6E4F0 cursor_text_color #19323B -# cursor_trail_color none +cursor_trail_color #E1B392 #################### ######################### diff --git a/ports/kitty/src/build.ts b/ports/kitty/src/build.ts index c1fe0fe..8654d2c 100644 --- a/ports/kitty/src/build.ts +++ b/ports/kitty/src/build.ts @@ -1,27 +1,12 @@ -import { name, version } from '../info.toml' -import { license, url } from '../../../package.json' import appRoot from 'app-root-path' import { rmFile, mkFilePath, appendToFile } from "../../../src/helpers/file" -import { - pit, - depths, - stope, - text, - orange, - teal, - red, - yellow, - green, - blue, - purple, -} from '../../../src/palette' +import { headerInfo, colorsBasic, colorsURLs, colorsCursor, colorsMarks, colorsTabBar, colorsBordersAndAlerts, colorsBasic16 } from './data' const file = appRoot + '/ports/kitty/dist/kitty.conf' const appendToKittyConf = async (content: string) => await appendToFile(file, content) export default async function(isVerbose = false): Promise { - console.log(file) if (isVerbose) console.info('Kitty: Removing previous build', file) try { await rmFile(file) @@ -44,122 +29,3 @@ export default async function(isVerbose = false): Promise { return file } -function headerInfo(): string { - return `######################### -# ${name} for kitty -# ${version} -# ${license} -# ${url} -#################### - -` -} - -function colorsBasic(): string { - return `######################### -# The basic colors -foreground ${text.toHex()} -background ${pit.toHex()} -selection_foreground ${depths.toHex()} -selection_background ${text.toHex()} -#################### - -` -} - -function colorsCursor(): string { - return `######################### -# Cursor colors -cursor ${text.toHex()} -cursor_text_color ${depths.toHex()} -# cursor_trail_color none -#################### - -` -} - -function colorsURLs(): string { - return `######################### -# URL colors -url_color ${blue.toHex()} -#################### - -` -} - -function colorsBordersAndAlerts(): string { - return `######################### -# window border colors and terminal bell colors -active_border_color ${teal.toHex()} -inactive_border_color ${stope.toHex()} -bell_border_color ${orange.toHex()} -# visual_bell_color none -#################### - -` -} - -function colorsTabBar(): string { - return `######################### -# Tab bar colors -active_tab_foreground ${text.toHex()} -active_tab_background ${depths.toHex()} -inactive_tab_foreground ${text.toHex()} -inactive_tab_background ${stope.toHex()} -# tab_bar_background #{pit.toHex()} -# tab_bar_margin_color none -#################### - -` -} - -function colorsMarks(): string { - return `######################### -# Marks colors -# mark1_foreground black -# mark1_background #98d3cb -# mark2_foreground black -# mark2_background #f2dcd3 -# mark3_foreground black -# mark3_background #f274bc -#################### - -` -} - -function colorsBasic16(): string { - return `######################### -# The basic 16 colors -#: black -color0 ${pit.toHex()} -color8 ${stope.toHex()} - -#: red -color1 ${red.toHex()} -color9 ${red.toHex()} - -#: green -color2 ${green.toHex()} -color10 ${green.toHex()} - -#: yellow -color3 ${yellow.toHex()} -color11 ${yellow.toHex()} - -#: blue -color4 ${blue.toHex()} -color12 ${blue.toHex()} - -#: magenta -color5 ${purple.toHex()} -color13 ${purple.toHex()} - -#: cyan -color6 ${teal.toHex()} -color14 ${teal.toHex()} - -#: white -color7 ${text.toHex()} -color15 ${text.toHex()} -####################` -} diff --git a/ports/kitty/src/data.ts b/ports/kitty/src/data.ts new file mode 100644 index 0000000..c737efc --- /dev/null +++ b/ports/kitty/src/data.ts @@ -0,0 +1,136 @@ +import { name, version } from '../info.toml' +import { license, url } from '../../../package.json' +import { + pit, + depths, + stope, + text, + orange, + teal, + red, + yellow, + green, + blue, + purple, +} from '../../../src/palette' + +export function headerInfo(): string { + return `######################### +# ${name} for kitty +# ${version} +# ${license} +# ${url} +#################### + +` +} + +export function colorsBasic(): string { + return `######################### +# The basic colors +foreground ${text.toHex()} +background ${pit.toHex()} +selection_foreground ${depths.toHex()} +selection_background ${text.toHex()} +#################### + +` +} + +export function colorsCursor(): string { + return `######################### +# Cursor colors +cursor ${text.toHex()} +cursor_text_color ${depths.toHex()} +cursor_trail_color ${yellow.toHex()} +#################### + +` +} + +export function colorsURLs(): string { + return `######################### +# URL colors +url_color ${blue.toHex()} +#################### + +` +} + +export function colorsBordersAndAlerts(): string { + return `######################### +# window border colors and terminal bell colors +active_border_color ${teal.toHex()} +inactive_border_color ${stope.toHex()} +bell_border_color ${orange.toHex()} +# visual_bell_color none +#################### + +` +} + +export function colorsTabBar(): string { + return `######################### +# Tab bar colors +active_tab_foreground ${text.toHex()} +active_tab_background ${depths.toHex()} +inactive_tab_foreground ${text.toHex()} +inactive_tab_background ${stope.toHex()} +# tab_bar_background #{pit.toHex()} +# tab_bar_margin_color none +#################### + +` +} + +export function colorsMarks(): string { + return `######################### +# Marks colors +# mark1_foreground black +# mark1_background #98d3cb +# mark2_foreground black +# mark2_background #f2dcd3 +# mark3_foreground black +# mark3_background #f274bc +#################### + +` +} + +export function colorsBasic16(): string { + return `######################### +# The basic 16 colors +#: black +color0 ${pit.toHex()} +color8 ${stope.toHex()} + +#: red +color1 ${red.toHex()} +color9 ${red.toHex()} + +#: green +color2 ${green.toHex()} +color10 ${green.toHex()} + +#: yellow +color3 ${yellow.toHex()} +color11 ${yellow.toHex()} + +#: blue +color4 ${blue.toHex()} +color12 ${blue.toHex()} + +#: magenta +color5 ${purple.toHex()} +color13 ${purple.toHex()} + +#: cyan +color6 ${teal.toHex()} +color14 ${teal.toHex()} + +#: white +color7 ${text.toHex()} +color15 ${text.toHex()} +####################` +} +