-
Notifications
You must be signed in to change notification settings - Fork 25
feat: color extraction #126
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?
Conversation
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.
Pull Request Overview
This PR introduces color extraction functionality from images to generate terminal themes. The implementation extracts dominant colors from wallpapers and converts them into platform-specific theme configurations supporting Ghostty, Kitty, iTerm, and Wezterm.
- Adds base16 color scheme extraction from images using dominant color analysis
- Implements theme generators for multiple terminal platforms
- Introduces a new
extractcommand to generate themes from the current wallpaper
Reviewed Changes
Copilot reviewed 12 out of 16 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/base16/extractor.go | Implements color extraction and base16 scheme generation from images |
| pkg/theme-generator/platform.go | Defines supported terminal platforms with type-safe enum pattern |
| pkg/theme-generator/builder.go | Contains templates and logic for generating platform-specific themes |
| pkg/theme-generator/builder_test.go | Adds test coverage for theme generation functionality |
| cmd/extract/root.go | Implements CLI command for extracting colors from wallpapers |
| lib/template.go | Adds iTerm RGB color formatting helper function |
| cmd/root.go | Registers the new extract command and removes debug statements |
| unsplash/auth.go | Fixes format string vulnerability in error handling |
| go.mod | Updates Go version and adds required dependencies |
| tests/parser_test.go | Renames test function to follow Go naming conventions |
| showcase.sh | Adds demo script for the new functionality |
| iterm.itermcolors | Example output file for iTerm theme |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pkg/theme-generator/platform.go
Outdated
| const ( | ||
| PlatformGhostty Platform = "ghostty" | ||
| PlatformKitty Platform = "kitty" | ||
| PlatfromIterm Platform = "iterm" |
Copilot
AI
Oct 25, 2025
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.
Corrected spelling of 'Platfrom' to 'Platform' in constant name.
pkg/theme-generator/platform.go
Outdated
| func PlatformValues() []string { | ||
| return []string{ | ||
| string(PlatformGhostty), | ||
| string(PlatfromIterm), |
Copilot
AI
Oct 25, 2025
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.
Corrected spelling of 'Platfrom' to 'Platform' in constant reference.
pkg/theme-generator/platform.go
Outdated
|
|
||
| func (p *Platform) Set(v string) error { | ||
| switch v { | ||
| case string(PlatformGhostty), string(PlatfromIterm), string(PlatformKitty), string(PlatformWezterm): |
Copilot
AI
Oct 25, 2025
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.
Corrected spelling of 'Platfrom' to 'Platform' in constant reference.
| "{base03}", # 8 | ||
| "{base08}", # 9 | ||
| "{base0B}", # 10 | ||
| "{base0A}", # 11 | ||
| "{base0D}", # 12 | ||
| "{base0E}", # 13 | ||
| "{base0C}", # 14 | ||
| "{base0F}", # 15 |
Copilot
AI
Oct 25, 2025
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.
Template placeholders use {baseXX} syntax instead of {{ .BaseXX }} which won't be replaced by Go's template engine. This will result in literal strings like {base03} in the output instead of actual color values.
| "{base03}", # 8 | |
| "{base08}", # 9 | |
| "{base0B}", # 10 | |
| "{base0A}", # 11 | |
| "{base0D}", # 12 | |
| "{base0E}", # 13 | |
| "{base0C}", # 14 | |
| "{base0F}", # 15 | |
| "{{ .Base03 }}", # 8 | |
| "{{ .Base08 }}", # 9 | |
| "{{ .Base0B }}", # 10 | |
| "{{ .Base0A }}", # 11 | |
| "{{ .Base0D }}", # 12 | |
| "{{ .Base0E }}", # 13 | |
| "{{ .Base0C }}", # 14 | |
| "{{ .Base0F }}", # 15 |
pkg/theme-generator/builder.go
Outdated
|
|
||
| templates := map[Platform]string{ | ||
| PlatformGhostty: ghosttyTemplate, | ||
| PlatfromIterm: itermTemplate, |
Copilot
AI
Oct 25, 2025
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.
Corrected spelling of 'Platfrom' to 'Platform' in constant reference.
| PlatfromIterm: itermTemplate, | |
| PlatformIterm: itermTemplate, |
e1bd91e to
fc33ce3
Compare
No description provided.