-
Notifications
You must be signed in to change notification settings - Fork 5
Fixed: logo misalignment in narrow terminal windows using breakpoints #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import gradient from "gradient-string"; | ||
|
||
const ASCII_LOGO = `╔──────────────────────────────────────────────────────────────────────────────────────╗ | ||
│ │ | ||
│ ██╗ █████╗ ███████╗██╗ ██╗ ██████╗ ██████╗ ███╗ ███╗███╗ ███╗██╗████████╗ │ | ||
│ ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██╔════╝██╔═══██╗████╗ ████║████╗ ████║██║╚══██╔══╝ │ | ||
│ ██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║ ██║██╔████╔██║██╔████╔██║██║ ██║ │ | ||
│ ██║ ██╔══██║ ███╔╝ ╚██╔╝ ██║ ██║ ██║██║╚██╔╝██║██║╚██╔╝██║██║ ██║ │ | ||
│ ███████╗██║ ██║███████╗ ██║ ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║██║ ██║ │ | ||
│ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ │ | ||
│ │ | ||
╚──────────────────────────────────────────────────────────────────────────────────────╝`; | ||
|
||
const ASCII_LOGO_MULTI_LINE = `╔─────────────────────────────────────────────────────╗ | ||
│ │ | ||
│ ██╗ █████╗ ███████╗██╗ ██╗ │ | ||
│ ██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝ │ | ||
│ ██║ ███████║ ███╔╝ ╚████╔╝ │ | ||
│ ██║ ██╔══██║ ███╔╝ ╚██╔╝ │ | ||
│ ███████╗██║ ██║███████╗ ██║ │ | ||
│ ╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ │ | ||
│ │ | ||
│ ██████╗ ██████╗ ███╗ ███╗███╗ ███╗██╗████████╗ │ | ||
│ ██╔════╝██╔═══██╗████╗ ████║████╗ ████║██║╚══██╔══╝ │ | ||
│ ██║ ██║ ██║██╔████╔██║██╔████╔██║██║ ██║ │ | ||
│ ██║ ██║ ██║██║╚██╔╝██║██║╚██╔╝██║██║ ██║ │ | ||
│ ╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚═╝ ██║██║ ██║ │ | ||
│ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ │ | ||
│ │ | ||
╚─────────────────────────────────────────────────────╝`; | ||
|
||
const ASCII_LOGO_MINI = `╔══════════════╗ | ||
║ LAZYCOMMIT ║ | ||
╚══════════════╝`; | ||
|
||
const gradientColors = [ | ||
"#F5C2E7", | ||
"#CBA6F7", | ||
"#F38BA8", | ||
"#E78284", | ||
"#FAB387", | ||
"#F9E2AF", | ||
"#A6E3A1", | ||
"#94E2D5", | ||
"#89DCEB", | ||
"#74C7EC", | ||
"#B4BEFE", | ||
]; | ||
|
||
function getTitle(width: number): string { | ||
if (width > 100) return ASCII_LOGO; | ||
if (width > 55) return ASCII_LOGO_MULTI_LINE; | ||
return ASCII_LOGO_MINI; | ||
} | ||
|
||
export const renderTitle = () => { | ||
const terminalWidth = process.stdout.columns || 55; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fallback value 55 is a magic number that should be extracted as a named constant. This value appears to correspond to one of the breakpoints and should be clearly documented. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
const title: string = getTitle(terminalWidth); | ||
console.log(gradient(gradientColors).multiline(title)); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The breakpoint values 100 and 55 are magic numbers that should be extracted as named constants to improve maintainability and make the layout logic more explicit.
Copilot uses AI. Check for mistakes.