From 555718c010bfcc896ef1de833c834425322df1cd Mon Sep 17 00:00:00 2001 From: Carlos Gutierrez Date: Sat, 10 Jan 2026 22:13:00 -0500 Subject: [PATCH] feat(v1.1.0): major refactor with modular architecture and plugin support - Add config.lua for comprehensive configuration options (transparent, italic_comments, bold_keywords, bold_functions, bold_types, terminal_colors) - Add highlights.lua with 500+ highlight groups for 30+ plugins (Telescope, NvimTree, Neo-tree, GitSigns, nvim-cmp, Lazy.nvim, Mason, etc.) - Add colors/ directory for :colorscheme command support - Add terminal colors (16-color palette for :terminal) - Add test suite (test/test_colors.lua) - Add development tools (selene.toml, stylua.toml, vim.toml) - Add CHANGELOG.md following Keep a Changelog format - Fix colors.lua not being used by init.lua - Fix setup(opts) not applying configuration options - Fix README referencing non-existent files - Update documentation with accurate file structure and API docs --- .gitignore | 25 +- CHANGELOG.md | 155 +++++++ CONTRIBUTING.md | 10 +- INSTALL.md | 191 ++++++-- README.md | 261 ++++++++--- colors/cargdev-cyberpunk.lua | 4 + lua/cargdev-cyberpunk/colors.lua | 62 ++- lua/cargdev-cyberpunk/config.lua | 38 ++ lua/cargdev-cyberpunk/highlights.lua | 628 +++++++++++++++++++++++++++ lua/cargdev-cyberpunk/init.lua | 283 ++++-------- lua/cargdev-cyberpunk/plugin.lua | 12 +- selene.toml | 48 ++ stylua.toml | 13 + test/test_colors.lua | 174 ++++++++ vim.toml | 56 +++ 15 files changed, 1626 insertions(+), 334 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 colors/cargdev-cyberpunk.lua create mode 100644 lua/cargdev-cyberpunk/config.lua create mode 100644 lua/cargdev-cyberpunk/highlights.lua create mode 100644 selene.toml create mode 100644 stylua.toml create mode 100644 test/test_colors.lua create mode 100644 vim.toml diff --git a/.gitignore b/.gitignore index 15cfc58..0c4c16c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ -### Lua ### -# Compiled Lua sources +# Lua compiled sources luac.out +*.luac -# luarocks build files +# LuaRocks build files *.src.rock *.zip *.tar.gz @@ -40,5 +40,22 @@ luac.out *.x86_64 *.hex +# Neovim +.nvim.lua +.nvimrc +.exrc -# End of https://www.toptal.com/developers/gitignore/api/lua +# Editor specific +.vscode/ +.idea/ +*.swp +*.swo +*~ +.DS_Store + +# Testing +.tests/ +coverage/ + +# Documentation build +doc/tags diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..00f4dcc --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,155 @@ +# Changelog + +All notable changes to CargDev-Cyberpunk.nvim will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +_No unreleased changes._ + +## [1.1.0] - 2026-01-10 + +### Added + +- **Configuration System**: New `config.lua` module with comprehensive options + - `transparent`: Enable transparent background for terminal transparency + - `italic_comments`: Toggle italic style for comments + - `bold_keywords`: Toggle bold style for keywords + - `bold_functions`: Toggle bold style for functions + - `bold_types`: Toggle bold style for types + - `terminal_colors`: Enable/disable terminal color definitions + - `colors`: Custom color override support + +- **Colorscheme Command**: Added `colors/cargdev-cyberpunk.lua` for `:colorscheme cargdev-cyberpunk` support + +- **Terminal Colors**: Full 16-color terminal palette for `:terminal` buffers + - Standard colors (black, red, green, yellow, blue, magenta, cyan, white) + - Bright variants for all colors + +- **Plugin Highlights**: Comprehensive highlight groups for 30+ plugins + - **File Explorers**: NvimTree, Neo-tree + - **Fuzzy Finders**: Telescope + - **Git Integration**: GitSigns, built-in diff + - **Completion**: nvim-cmp with kind-specific colors + - **UI Enhancements**: indent-blankline, which-key, bufferline, lualine + - **Plugin Managers**: Lazy.nvim, Mason + - **Notifications**: nvim-notify, noice.nvim + - **Diagnostics**: trouble.nvim + - **Dashboards**: dashboard-nvim, alpha-nvim + - **AI**: Copilot suggestions + +- **Diagnostic Highlights**: Complete diagnostic highlight groups + - Virtual text, underline, floating, and sign variants + - Error, warning, info, hint, and ok severity levels + +- **LSP Highlights**: Enhanced LSP support + - Reference highlighting (text, read, write) + - Signature help active parameter + - Code lens and inlay hints + - Semantic token modifiers (deprecated, readonly, defaultLibrary) + +- **Treesitter Highlights**: Expanded treesitter capture groups + - Comment variants (error, warning, todo, note) + - Punctuation groups (bracket, delimiter, special) + - Additional keyword groups (function, operator, return, import, export) + +- **Test Suite**: Added `test/test_colors.lua` for verification + - Tests color palette structure and format + - Tests configuration defaults + - Tests highlight group existence + - Tests module function exports + +- **Development Tools** + - `selene.toml`: Lua linting configuration + - `stylua.toml`: Lua formatting configuration + - `vim.toml`: Neovim globals definition for selene + +### Changed + +- **Architecture Refactor**: Modular design with separated concerns + - `init.lua`: Main entry point with setup, load, and apply functions + - `colors.lua`: Centralized color palette with override support + - `config.lua`: Configuration management with defaults + - `highlights.lua`: All highlight group definitions organized by category + - `plugin.lua`: Plugin metadata + +- **Color Module**: Now properly integrated with init.lua + - Added `palette` table structure with typed annotations + - Added `override()` function for runtime color customization + - Added `get_palette()` function to retrieve a copy of colors + +- **Init Module**: Complete rewrite + - `setup(opts)` now accepts and applies configuration options + - `load()` function properly resets colors and sets `vim.g.colors_name` + - `apply_highlights()` uses colors and config modules + - `apply_terminal_colors()` sets `vim.g.terminal_color_*` variables + - `get_colors()` returns the current color palette + +- **Plugin Metadata**: Updated version to 1.1.0 in `plugin.lua` + +### Fixed + +- **Color Inconsistency**: `init.lua` now uses `colors.lua` instead of defining colors inline +- **Unused Colors Module**: The `colors.lua` module is now properly imported and used +- **Non-functional Configuration**: `setup(opts)` now actually applies user options +- **Documentation Errors**: README and INSTALL.md now reference correct file structure + +### Documentation + +- Updated README.md with: + - Configuration options table + - Plugin support list + - Correct architecture diagram + - API documentation + - Testing instructions + +- Updated INSTALL.md with: + - Advanced configuration examples + - Troubleshooting section + - Verification steps + +- Updated CONTRIBUTING.md with: + - Correct file structure + +## [1.0.0] - 2024-01-01 + +### Added + +- Initial release of CargDev-Cyberpunk.nvim +- Cyberpunk-inspired color palette with neon accents +- Deep blue background (`#002B36`) with vibrant syntax colors +- Basic syntax highlighting for Vim default groups +- Treesitter highlight support +- LSP semantic token highlighting +- TypeScript/JavaScript optimized colors +- Basic editor UI highlights (Normal, Cursor, Visual, Search, etc.) +- Status line and tab line highlights +- Popup menu highlights +- Diff highlights +- Spell checking highlights +- Copilot suggestion highlights +- MIT License +- README with installation instructions +- INSTALL.md guide +- CONTRIBUTING.md guidelines +- Example TypeScript file for testing + +### Color Palette + +- **Background**: `#002B36` (deep blue) +- **Foreground**: `#E0E0E0` (light gray) +- **Keywords**: `#FF79C6` (hot pink) +- **Functions**: `#50FA7B` (neon green) +- **Strings**: `#FFFFFF` (white) +- **Numbers**: `#FFB86C` (orange) +- **Types**: `#BD93F9` (purple) +- **Comments**: `#666666` (gray) +- **Errors**: `#FF5555` (red) +- **Warnings**: `#FFB86C` (orange) +- **Info**: `#8BE9FD` (cyan) + +[Unreleased]: https://github.com/yourusername/cargdev-cyberpunk.nvim/compare/v1.1.0...HEAD +[1.1.0]: https://github.com/yourusername/cargdev-cyberpunk.nvim/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/yourusername/cargdev-cyberpunk.nvim/releases/tag/v1.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 679e816..65add7a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,7 +66,15 @@ Thank you for your interest in contributing to CargDev-Cyberpunk.nvim! This docu lua/cargdev-cyberpunk/ ├── init.lua # Main plugin entry point ├── colors.lua # Color palette definitions -└── plugin.lua # Plugin configuration +├── config.lua # Configuration management +├── highlights.lua # Highlight group definitions +└── plugin.lua # Plugin metadata + +colors/ +└── cargdev-cyberpunk.lua # Colorscheme command file + +test/ +└── test_colors.lua # Test suite ``` ### Color Guidelines diff --git a/INSTALL.md b/INSTALL.md index e1afe97..97dc5f8 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -5,7 +5,8 @@ This guide will help you install and configure the CargDev-Cyberpunk.nvim color ## Prerequisites - Neovim 0.8.0 or higher -- A plugin manager (Packer, Lazy.nvim, vim-plug, etc.) +- A plugin manager (Lazy.nvim, Packer, vim-plug, etc.) +- `termguicolors` support (automatically enabled by the plugin) ## Quick Installation @@ -14,22 +15,24 @@ This guide will help you install and configure the CargDev-Cyberpunk.nvim color Add this to your Neovim configuration: ```lua --- In your init.lua or plugins.lua +-- In your plugins.lua or init.lua { - 'cargdev-cyberpunk.nvim', - config = true, - priority = 1000, -- Load early + "yourusername/cargdev-cyberpunk.nvim", + lazy = false, -- Load during startup + priority = 1000, -- Load before other plugins + config = function() + require("cargdev-cyberpunk").setup() + end, } ``` ### Using Packer ```lua --- In your init.lua or plugins.lua use { - 'cargdev-cyberpunk.nvim', + "yourusername/cargdev-cyberpunk.nvim", config = function() - require('cargdev-cyberpunk').setup() + require("cargdev-cyberpunk").setup() end } ``` @@ -38,39 +41,115 @@ use { ```vim " In your .vimrc or init.vim -Plug 'cargdev-cyberpunk.nvim' +Plug 'yourusername/cargdev-cyberpunk.nvim' ``` -Then in your Neovim configuration: +Then in your Neovim Lua configuration: + ```lua -require('cargdev-cyberpunk').setup() +require("cargdev-cyberpunk").setup() ``` ## Manual Installation 1. Clone the repository: + ```bash -git clone https://github.com/yourusername/cargdev-cyberpunk.nvim ~/.local/share/nvim/site/pack/plugins/start/cargdev-cyberpunk.nvim +git clone https://github.com/yourusername/cargdev-cyberpunk.nvim \ + ~/.local/share/nvim/site/pack/plugins/start/cargdev-cyberpunk.nvim ``` 2. Add to your Neovim configuration: + ```lua -require('cargdev-cyberpunk').setup() +require("cargdev-cyberpunk").setup() ``` +## Using Colorscheme Command + +After installation, you can also load the colorscheme with the standard command: + +```vim +:colorscheme cargdev-cyberpunk +``` + +This is useful if you want to switch colorschemes dynamically. + ## Configuration ### Basic Configuration ```lua -require('cargdev-cyberpunk').setup() +require("cargdev-cyberpunk").setup() ``` ### Advanced Configuration ```lua -require('cargdev-cyberpunk').setup({ - -- Configuration options will be added in future versions +require("cargdev-cyberpunk").setup({ + -- Enable transparent background (useful for terminal transparency) + transparent = false, + + -- Typography styles + italic_comments = true, -- Italicize comments + bold_keywords = true, -- Bold keywords (if, for, function, etc.) + bold_functions = true, -- Bold function names + bold_types = true, -- Bold type names + + -- Terminal integration + terminal_colors = true, -- Set colors for :terminal + + -- Custom color overrides + colors = { + bg = { + primary = "#000000", -- Pure black background + }, + syntax = { + keyword = "#FF00FF", -- Custom keyword color + }, + }, +}) +``` + +### Transparent Background + +If you use a terminal with transparency, enable the transparent option: + +```lua +require("cargdev-cyberpunk").setup({ + transparent = true, +}) +``` + +### Customizing Colors + +Override any color in the palette: + +```lua +require("cargdev-cyberpunk").setup({ + colors = { + -- Background colors + bg = { + primary = "#1a1a2e", + secondary = "#16213e", + }, + -- Foreground colors + fg = { + primary = "#ffffff", + accent = "#00ffff", + }, + -- Syntax colors + syntax = { + keyword = "#ff6b6b", + ["function"] = "#4ecdc4", + string = "#ffe66d", + }, + -- Diagnostic colors + special = { + error = "#ff4757", + warning = "#ffa502", + }, + }, }) ``` @@ -79,45 +158,85 @@ require('cargdev-cyberpunk').setup({ To verify the installation: 1. Open Neovim -2. Open a TypeScript file (like the example in `examples/sample.ts`) -3. You should see vibrant colors applied to different syntax elements +2. Check that colors are applied: `:hi Normal` +3. Open a TypeScript file (like `examples/sample.ts`) +4. Verify syntax highlighting is working -### Test the Installation +### Run Tests -You can run the test file to verify everything is working: +You can run the test suite to verify everything works: -```lua --- In Neovim, run: +```bash +nvim --headless -c "lua dofile('test/test_colors.lua')" +``` + +Or from within Neovim: + +```vim :lua dofile('test/test_colors.lua') ``` ## Troubleshooting -### Colors not appearing +### Colors not appearing correctly -1. Make sure you have Treesitter installed and configured -2. Ensure LSP is properly set up for TypeScript -3. Check that the plugin is loaded correctly +1. Ensure `termguicolors` is supported by your terminal +2. Check that the plugin is loaded: `:lua print(vim.inspect(package.loaded['cargdev-cyberpunk']))` +3. Try reloading: `:lua require('cargdev-cyberpunk').load()` ### Plugin not found 1. Verify the plugin is installed in the correct directory -2. Check your plugin manager configuration +2. Run `:checkhealth` to diagnose issues 3. Restart Neovim after installation -### Performance issues +### Treesitter highlights not working -1. The color scheme is optimized for performance -2. If you experience issues, try disabling other color schemes -3. Ensure you're using Neovim 0.8.0 or higher +1. Ensure Treesitter is installed: `:TSInstallInfo` +2. Install parsers: `:TSInstall typescript tsx` +3. Restart Neovim + +### LSP semantic tokens not working + +1. Ensure your LSP supports semantic tokens +2. Check LSP status: `:LspInfo` +3. Verify LSP is attached: `:lua print(vim.inspect(vim.lsp.get_active_clients()))` + +### Terminal colors look wrong + +1. Verify `terminal_colors` is enabled in config +2. Open a new terminal buffer: `:terminal` +3. Check terminal colors are set: `:lua print(vim.g.terminal_color_0)` + +## Updating + +### With Lazy.nvim + +```vim +:Lazy update cargdev-cyberpunk.nvim +``` + +### With Packer + +```vim +:PackerUpdate cargdev-cyberpunk.nvim +``` + +### Manual + +```bash +cd ~/.local/share/nvim/site/pack/plugins/start/cargdev-cyberpunk.nvim +git pull +``` ## Uninstallation To remove the color scheme: -1. Remove the plugin from your plugin manager -2. Remove any configuration lines from your Neovim config -3. Restart Neovim +1. Remove the plugin from your plugin manager configuration +2. Remove any setup calls from your Neovim config +3. Run your plugin manager's clean/sync command +4. Restart Neovim ## Support @@ -125,11 +244,11 @@ If you encounter issues: 1. Check the [Issues](https://github.com/yourusername/cargdev-cyberpunk.nvim/issues) page 2. Create a new issue with: - - Your Neovim version + - Your Neovim version (`:version`) - Plugin manager and configuration - Error messages - Steps to reproduce ## Contributing -See the main README.md for contribution guidelines. \ No newline at end of file +See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines. diff --git a/README.md b/README.md index ac873ed..09e4e04 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,13 @@ A vibrant, high-contrast Neovim color scheme crafted for developers who thrive i ## Features -- **High-Contrast Neon Colors**: Hot pink keywords, electric purple types, vibrant cyan strings, and lush green functions +- **High-Contrast Neon Colors**: Hot pink keywords, electric purple types, vibrant cyan accents, and lush green functions - **Cyberpunk Aesthetic**: Deep blue backgrounds with neon accents for maximum visual impact - **TypeScript Support**: Comprehensive LSP and Treesitter highlighting for TypeScript/JavaScript -- **Atomic Design**: Modular structure following atomic design principles -- **Bold Styling**: High-saturation colors with bold styling for maximum readability -- **LSP Integration**: Full support for Language Server Protocol highlighting +- **Configurable**: Transparent background, italic/bold toggles, and custom color overrides +- **Plugin Integration**: Native support for Telescope, NvimTree, Neo-tree, GitSigns, nvim-cmp, Lazy.nvim, and more +- **Terminal Colors**: Full 16-color terminal palette for `:terminal` +- **LSP Integration**: Full support for Language Server Protocol highlighting and semantic tokens - **Treesitter Support**: Advanced syntax highlighting with Treesitter ## Screenshots @@ -29,121 +30,190 @@ A vibrant, high-contrast Neovim color scheme crafted for developers who thrive i ## Color Palette ### Syntax Colors -- **Keywords**: `#FF79C6` - Control flow and declarations (bold) -- **Functions**: `#50FA7B` - Function calls and definitions (bold) -- **Strings**: `#8BE9FD` - String literals and comments -- **Numbers**: `#FFB86C` - Numeric literals and constants -- **Types**: `#BD93F9` - Type annotations and interfaces (bold) -- **Variables**: `#BD93F9` - Variable names -- **Properties**: `#50FA7B` - Object properties (bold) +| Element | Color | Preview | +|---------|-------|---------| +| Keywords | `#FF79C6` | Control flow and declarations (bold) | +| Functions | `#50FA7B` | Function calls and definitions (bold) | +| Strings | `#FFFFFF` | String literals | +| Numbers | `#FFB86C` | Numeric literals and constants | +| Types | `#BD93F9` | Type annotations and interfaces (bold) | +| Variables | `#BD93F9` | Variable names | +| Properties | `#50FA7B` | Object properties (bold) | +| Comments | `#666666` | Code comments (italic) | ### Background Colors -- **Primary**: `#002B36` - Deep blue background -- **Secondary**: `#003B46` - Secondary background -- **Tertiary**: `#004B56` - Tertiary background -- **Cursor Line**: `#112233` - Slightly lighter than background -- **Selection**: `#44475A` - Selection highlight +| Element | Color | Description | +|---------|-------|-------------| +| Primary | `#002B36` | Main background | +| Secondary | `#003B46` | Sidebars and floating windows | +| Tertiary | `#004B56` | Selected tabs and highlights | +| Cursor Line | `#112233` | Current line highlight | +| Selection | `#44475A` | Visual selection | -### Special Colors -- **Error**: `#FF5555` - Error messages (bold) -- **Warning**: `#FFB86C` - Warning messages -- **Info**: `#8BE9FD` - Information messages -- **Success**: `#50FA7B` - Success indicators +### Diagnostic Colors +| Type | Color | +|------|-------| +| Error | `#FF5555` | +| Warning | `#FFB86C` | +| Info | `#8BE9FD` | +| Hint | `#50FA7B` | ## Installation +### Using Lazy.nvim (Recommended) + +```lua +{ + "yourusername/cargdev-cyberpunk.nvim", + lazy = false, + priority = 1000, + config = function() + require("cargdev-cyberpunk").setup() + end, +} +``` + ### Using Packer + ```lua use { - 'cargdev-cyberpunk.nvim', + "yourusername/cargdev-cyberpunk.nvim", config = function() - require('cargdev-cyberpunk').setup() + require("cargdev-cyberpunk").setup() end } ``` -### Using Lazy.nvim +### Using vim-plug + +```vim +Plug 'yourusername/cargdev-cyberpunk.nvim' +``` + +Then in your Lua config: + ```lua -{ - 'cargdev-cyberpunk.nvim', - config = true, -} +require("cargdev-cyberpunk").setup() ``` ### Manual Installation -1. Clone this repository to your Neovim plugins directory: -```bash -git clone https://github.com/yourusername/cargdev-cyberpunk.nvim ~/.local/share/nvim/site/pack/plugins/start/cargdev-cyberpunk.nvim -``` -2. Add to your `init.lua`: -```lua -require('cargdev-cyberpunk').setup() +Clone this repository to your Neovim plugins directory: + +```bash +git clone https://github.com/yourusername/cargdev-cyberpunk.nvim \ + ~/.local/share/nvim/site/pack/plugins/start/cargdev-cyberpunk.nvim ``` ## Configuration ### Basic Setup + ```lua -require('cargdev-cyberpunk').setup() +require("cargdev-cyberpunk").setup() +``` + +### Using Colorscheme Command + +After installation, you can load the colorscheme with: + +```vim +:colorscheme cargdev-cyberpunk ``` ### Advanced Configuration -```lua -require('cargdev-cyberpunk').setup({ - -- Future configuration options will be added here -}) -``` - -### Customizing Colors -You can easily override colors by requiring the colors module: ```lua -local colors = require('cargdev-cyberpunk.colors') +require("cargdev-cyberpunk").setup({ + -- Enable transparent background + transparent = false, --- Override specific colors -colors.override({ - syntax = { - keyword = "#FF0000", -- Make keywords red - function = "#00FF00", -- Make functions green + -- Style options + italic_comments = true, + bold_keywords = true, + bold_functions = true, + bold_types = true, + + -- Enable terminal colors + terminal_colors = true, + + -- Custom color overrides + colors = { + syntax = { + keyword = "#FF0000", -- Make keywords red + }, + bg = { + primary = "#000000", -- Pure black background + }, }, - bg = { - primary = "#000000", -- Make background pure black - } }) ``` -## Usage +### Configuration Options -After installation, the color scheme will be automatically applied. You can also manually apply it: +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `transparent` | boolean | `false` | Enable transparent background | +| `italic_comments` | boolean | `true` | Use italic style for comments | +| `bold_keywords` | boolean | `true` | Use bold style for keywords | +| `bold_functions` | boolean | `true` | Use bold style for functions | +| `bold_types` | boolean | `true` | Use bold style for types | +| `terminal_colors` | boolean | `true` | Set terminal colors for `:terminal` | +| `colors` | table | `{}` | Custom color overrides | -```lua --- Apply the color scheme -require('cargdev-cyberpunk').apply_highlights() -``` +## Plugin Support + +CargDev-Cyberpunk includes native highlight groups for these plugins: + +- **Telescope**: Search and picker UI +- **NvimTree / Neo-tree**: File explorers +- **GitSigns**: Git diff indicators +- **nvim-cmp**: Completion menu +- **indent-blankline**: Indentation guides +- **which-key**: Keybinding hints +- **Lazy.nvim**: Plugin manager UI +- **Mason**: LSP/DAP installer UI +- **bufferline.nvim**: Buffer tabs +- **lualine.nvim**: Status line +- **nvim-notify**: Notification popups +- **noice.nvim**: UI replacement +- **trouble.nvim**: Diagnostics list +- **dashboard-nvim / alpha-nvim**: Start screen +- **Copilot**: AI suggestions ## Architecture -The plugin follows atomic design principles with a modular structure: +The plugin follows a modular structure: ``` lua/cargdev-cyberpunk/ -├── init.lua # Main plugin entry point +├── init.lua # Main entry point and setup ├── colors.lua # Color palette definitions -└── plugin.lua # Plugin configuration +├── config.lua # Configuration management +├── highlights.lua # Highlight group definitions +└── plugin.lua # Plugin metadata + +colors/ +└── cargdev-cyberpunk.lua # Colorscheme command file + +test/ +└── test_colors.lua # Test suite ``` ### Modules -- **`init.lua`**: Main setup and configuration functions -- **`colors.lua`**: Centralized color palette with vibrant cyberpunk colors -- **`highlights.lua`**: Comprehensive highlight group definitions for all syntax elements +- **`init.lua`**: Main setup, load, and apply functions +- **`colors.lua`**: Centralized color palette with override support +- **`config.lua`**: Configuration defaults and user options +- **`highlights.lua`**: All highlight group definitions organized by category +- **`plugin.lua`**: Plugin metadata (name, version, author) ## TypeScript Support This color scheme includes extensive TypeScript support: - **LSP Integration**: Full support for TypeScript Language Server highlighting +- **Semantic Tokens**: Enhanced highlighting with LSP semantic tokens - **Treesitter**: Advanced syntax highlighting with Treesitter - **Type Annotations**: Special highlighting for type annotations and interfaces - **Import/Export**: Distinct colors for import and export statements @@ -153,18 +223,70 @@ This color scheme includes extensive TypeScript support: ## Requirements - Neovim 0.8.0 or higher +- `termguicolors` enabled (automatically set by the plugin) - Treesitter (recommended for best experience) - LSP support (recommended for TypeScript features) +## Testing + +Run the test suite: + +```bash +nvim --headless -c "lua dofile('test/test_colors.lua')" +``` + +Or from within Neovim: + +```lua +:lua dofile('test/test_colors.lua') +``` + +## API + +### Functions + +```lua +local cyberpunk = require("cargdev-cyberpunk") + +-- Setup with options +cyberpunk.setup(opts) + +-- Load/reload the colorscheme +cyberpunk.load() + +-- Apply highlights (useful for refreshing) +cyberpunk.apply_highlights() + +-- Get the current color palette +local colors = cyberpunk.get_colors() +``` + +### Accessing Colors + +```lua +local colors = require("cargdev-cyberpunk.colors") + +-- Get the palette +local palette = colors.palette + +-- Override colors +colors.override({ + syntax = { + keyword = "#FF0000", + }, +}) +``` + ## Contributing -Contributions are welcome! Please feel free to submit a Pull Request. +Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines. ### Development Setup + 1. Fork the repository -2. Create a feature branch +2. Clone your fork locally 3. Make your changes -4. Test thoroughly +4. Run tests: `nvim --headless -c "lua dofile('test/test_colors.lua')"` 5. Submit a pull request ## License @@ -174,6 +296,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file ## Acknowledgments - **Neovim Community**: For the excellent plugin ecosystem +- **Dracula Theme**: Inspiration for some color choices - **Cyberpunk Aesthetic**: Inspired by the vibrant neon colors of cyberpunk culture ## Support @@ -188,4 +311,4 @@ If you encounter any issues or have questions: **Enjoy coding with vibrant colors!** -*"If I squint at this theme, I should feel like Tron is about to compile!"* +*"If I squint at this theme, I should feel like Tron is about to compile!"* diff --git a/colors/cargdev-cyberpunk.lua b/colors/cargdev-cyberpunk.lua new file mode 100644 index 0000000..d6f4ead --- /dev/null +++ b/colors/cargdev-cyberpunk.lua @@ -0,0 +1,4 @@ +-- CargDev-Cyberpunk colorscheme +-- Load with: colorscheme cargdev-cyberpunk + +require("cargdev-cyberpunk").load() diff --git a/lua/cargdev-cyberpunk/colors.lua b/lua/cargdev-cyberpunk/colors.lua index 27672ef..47fb68e 100644 --- a/lua/cargdev-cyberpunk/colors.lua +++ b/lua/cargdev-cyberpunk/colors.lua @@ -1,4 +1,13 @@ -local colors = { +---@class CargdevCyberpunkPalette +---@field bg table Background colors +---@field fg table Foreground colors +---@field syntax table Syntax highlighting colors +---@field special table Special/diagnostic colors + +local M = {} + +---@type CargdevCyberpunkPalette +M.palette = { bg = { primary = "#002B36", secondary = "#003B46", @@ -7,46 +16,75 @@ local colors = { highlight = "#112233", selection = "#44475A", }, - + fg = { primary = "#E0E0E0", secondary = "#B8B8B8", muted = "#888888", accent = "#8BE9FD", }, - + syntax = { keyword = "#FF79C6", ["function"] = "#50FA7B", - string = "#8BE9FD", + string = "#FFFFFF", number = "#FFB86C", - comment = "#8BE9FD", + comment = "#666666", type = "#BD93F9", constant = "#FFB86C", operator = "#FF79C6", variable = "#BD93F9", property = "#50FA7B", }, - + special = { error = "#FF5555", warning = "#FFB86C", info = "#8BE9FD", + hint = "#50FA7B", success = "#50FA7B", diff_add = "#50FA7B", diff_delete = "#FF5555", diff_change = "#FFB86C", - } + }, + + -- Terminal colors (for :terminal) + terminal = { + black = "#002B36", + red = "#FF5555", + green = "#50FA7B", + yellow = "#FFB86C", + blue = "#BD93F9", + magenta = "#FF79C6", + cyan = "#8BE9FD", + white = "#E0E0E0", + bright_black = "#44475A", + bright_red = "#FF6E67", + bright_green = "#5AF78E", + bright_yellow = "#F4F99D", + bright_blue = "#CAA9FA", + bright_magenta = "#FF92DF", + bright_cyan = "#9AEDFE", + bright_white = "#F8F8F2", + }, } -function colors.override(new_colors) - for category, values in pairs(new_colors) do - if colors[category] then +---Override palette colors with custom values +---@param custom_colors table Partial palette override +function M.override(custom_colors) + for category, values in pairs(custom_colors) do + if M.palette[category] then for key, value in pairs(values) do - colors[category][key] = value + M.palette[category][key] = value end end end end -return colors \ No newline at end of file +---Get a copy of the current palette +---@return CargdevCyberpunkPalette +function M.get_palette() + return vim.deepcopy(M.palette) +end + +return M diff --git a/lua/cargdev-cyberpunk/config.lua b/lua/cargdev-cyberpunk/config.lua new file mode 100644 index 0000000..ce2b832 --- /dev/null +++ b/lua/cargdev-cyberpunk/config.lua @@ -0,0 +1,38 @@ +---@class CargdevCyberpunkConfig +---@field transparent boolean Enable transparent background +---@field italic_comments boolean Use italic style for comments +---@field bold_keywords boolean Use bold style for keywords +---@field bold_functions boolean Use bold style for functions +---@field bold_types boolean Use bold style for types +---@field terminal_colors boolean Set terminal colors +---@field colors table Custom color overrides + +local M = {} + +---@type CargdevCyberpunkConfig +M.defaults = { + transparent = false, + italic_comments = true, + bold_keywords = true, + bold_functions = true, + bold_types = true, + terminal_colors = true, + colors = {}, +} + +---@type CargdevCyberpunkConfig +M.options = {} + +---Setup configuration +---@param opts? CargdevCyberpunkConfig +function M.setup(opts) + M.options = vim.tbl_deep_extend("force", {}, M.defaults, opts or {}) +end + +---Get current configuration +---@return CargdevCyberpunkConfig +function M.get() + return M.options +end + +return M diff --git a/lua/cargdev-cyberpunk/highlights.lua b/lua/cargdev-cyberpunk/highlights.lua new file mode 100644 index 0000000..0ce06c6 --- /dev/null +++ b/lua/cargdev-cyberpunk/highlights.lua @@ -0,0 +1,628 @@ +local M = {} + +---Generate highlight groups based on colors and config +---@param colors table Color palette +---@param config table Configuration options +---@return table Highlight groups +function M.get_groups(colors, config) + local c = colors + local cfg = config + + -- Helper for conditional styles + local function style(bold, italic) + local s = {} + if bold then s.bold = true end + if italic then s.italic = true end + return s + end + + local bold_kw = cfg.bold_keywords and { bold = true } or {} + local bold_fn = cfg.bold_functions and { bold = true } or {} + local bold_ty = cfg.bold_types and { bold = true } or {} + local italic_comment = cfg.italic_comments and { italic = true } or {} + + local bg_primary = cfg.transparent and "NONE" or c.bg.primary + + return { + -- ============================================================ + -- Editor UI + -- ============================================================ + Normal = { fg = c.fg.primary, bg = bg_primary }, + NormalFloat = { fg = c.fg.primary, bg = c.bg.float }, + NormalNC = { fg = c.fg.primary, bg = bg_primary }, + FloatBorder = { fg = c.fg.accent, bg = c.bg.float }, + FloatTitle = { fg = c.fg.accent, bg = c.bg.float, bold = true }, + + -- Line numbers + LineNr = { fg = c.fg.muted }, + LineNrAbove = { fg = c.fg.muted }, + LineNrBelow = { fg = c.fg.muted }, + CursorLineNr = { fg = c.fg.accent, bold = true }, + SignColumn = { fg = c.fg.muted, bg = bg_primary }, + FoldColumn = { fg = c.fg.muted, bg = bg_primary }, + + -- Cursor + Cursor = { fg = c.bg.primary, bg = c.fg.accent }, + lCursor = { fg = c.bg.primary, bg = c.fg.accent }, + CursorIM = { fg = c.bg.primary, bg = c.fg.accent }, + CursorLine = { bg = c.bg.highlight }, + CursorColumn = { bg = c.bg.highlight }, + ColorColumn = { bg = c.bg.secondary }, + Conceal = { fg = c.fg.muted }, + + -- Visual + Visual = { bg = c.bg.selection }, + VisualNOS = { bg = c.bg.selection }, + + -- Search + Search = { fg = c.bg.primary, bg = c.special.warning }, + IncSearch = { fg = c.bg.primary, bg = c.syntax.number }, + CurSearch = { fg = c.bg.primary, bg = c.special.warning, bold = true }, + Substitute = { fg = c.bg.primary, bg = c.special.error }, + + -- Status line + StatusLine = { fg = c.fg.primary, bg = c.bg.secondary }, + StatusLineNC = { fg = c.fg.muted, bg = c.bg.secondary }, + StatusLineTerm = { fg = c.fg.primary, bg = c.bg.secondary }, + StatusLineTermNC = { fg = c.fg.muted, bg = c.bg.secondary }, + WinBar = { fg = c.fg.primary, bg = bg_primary }, + WinBarNC = { fg = c.fg.muted, bg = bg_primary }, + WinSeparator = { fg = c.bg.tertiary, bg = bg_primary }, + VertSplit = { fg = c.bg.tertiary, bg = bg_primary }, + + -- Tab line + TabLine = { fg = c.fg.muted, bg = c.bg.secondary }, + TabLineFill = { bg = c.bg.secondary }, + TabLineSel = { fg = c.fg.accent, bg = c.bg.tertiary, bold = true }, + + -- Popup menu + Pmenu = { fg = c.fg.primary, bg = c.bg.float }, + PmenuSel = { fg = c.bg.primary, bg = c.fg.accent }, + PmenuSbar = { bg = c.bg.float }, + PmenuThumb = { bg = c.bg.highlight }, + + -- Messages + ModeMsg = { fg = c.fg.primary, bold = true }, + MsgArea = { fg = c.fg.primary }, + MsgSeparator = { fg = c.fg.muted }, + MoreMsg = { fg = c.special.info }, + Question = { fg = c.special.info }, + ErrorMsg = { fg = c.special.error, bold = true }, + WarningMsg = { fg = c.special.warning, bold = true }, + + -- Folds + Folded = { fg = c.fg.muted, bg = c.bg.secondary }, + MatchParen = { fg = c.special.warning, bg = c.bg.selection, bold = true }, + NonText = { fg = c.fg.muted }, + SpecialKey = { fg = c.fg.muted }, + Whitespace = { fg = c.bg.selection }, + EndOfBuffer = { fg = c.bg.primary }, + + -- Directory + Directory = { fg = c.syntax["function"], bold = true }, + Title = { fg = c.syntax.keyword, bold = true }, + + -- Diff + DiffAdd = { fg = c.special.diff_add, bg = "#1a3a1a" }, + DiffChange = { fg = c.special.diff_change, bg = "#3a3a1a" }, + DiffDelete = { fg = c.special.diff_delete, bg = "#3a1a1a" }, + DiffText = { fg = c.fg.primary, bg = c.special.diff_change }, + + -- Spell + SpellBad = { sp = c.special.error, undercurl = true }, + SpellCap = { sp = c.special.warning, undercurl = true }, + SpellLocal = { sp = c.special.info, undercurl = true }, + SpellRare = { sp = c.special.success, undercurl = true }, + + -- ============================================================ + -- Syntax highlighting (Vim defaults) + -- ============================================================ + Comment = vim.tbl_extend("force", { fg = c.syntax.comment }, italic_comment), + String = { fg = c.syntax.string }, + Character = { fg = c.syntax.string }, + Number = { fg = c.syntax.number }, + Boolean = { fg = c.syntax.constant }, + Float = { fg = c.syntax.number }, + + Identifier = { fg = c.syntax.variable }, + Function = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + + Statement = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Conditional = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Repeat = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Label = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Operator = vim.tbl_extend("force", { fg = c.syntax.operator }, bold_kw), + Keyword = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Exception = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + + PreProc = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Include = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Define = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Macro = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + PreCondit = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + + Type = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + StorageClass = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + Structure = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + Typedef = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + + Special = { fg = c.syntax.property }, + SpecialChar = { fg = c.syntax.property }, + Tag = { fg = c.syntax.property }, + Delimiter = { fg = c.syntax.operator }, + SpecialComment = { fg = c.syntax.comment }, + Debug = { fg = c.syntax.property }, + + Underlined = { underline = true }, + Ignore = { fg = c.fg.muted }, + Error = { fg = c.special.error, bold = true }, + Todo = { fg = c.special.warning, bold = true }, + + -- ============================================================ + -- Treesitter highlights + -- ============================================================ + ["@text"] = { fg = c.fg.primary }, + ["@text.strong"] = { bold = true }, + ["@text.emphasis"] = { italic = true }, + ["@text.underline"] = { underline = true }, + ["@text.strike"] = { strikethrough = true }, + ["@text.literal"] = { fg = c.syntax.string }, + ["@text.uri"] = { fg = c.syntax["function"], underline = true }, + ["@text.title"] = { fg = c.syntax.keyword, bold = true }, + ["@text.reference"] = { fg = c.fg.accent }, + + ["@comment"] = vim.tbl_extend("force", { fg = c.syntax.comment }, italic_comment), + ["@comment.documentation"] = { fg = c.syntax.comment }, + ["@comment.error"] = { fg = c.special.error }, + ["@comment.warning"] = { fg = c.special.warning }, + ["@comment.todo"] = { fg = c.special.warning, bold = true }, + ["@comment.note"] = { fg = c.special.info }, + + ["@constant"] = { fg = c.syntax.constant }, + ["@constant.builtin"] = { fg = c.syntax.constant }, + ["@constant.macro"] = { fg = c.syntax.constant }, + + ["@define"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@macro"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + + ["@string"] = { fg = c.syntax.string }, + ["@string.escape"] = { fg = c.syntax.property }, + ["@string.special"] = { fg = c.syntax.property }, + ["@string.regex"] = { fg = c.syntax.property }, + + ["@character"] = { fg = c.syntax.string }, + ["@character.special"] = { fg = c.syntax.property }, + ["@number"] = { fg = c.syntax.number }, + ["@number.float"] = { fg = c.syntax.number }, + ["@boolean"] = { fg = c.syntax.constant }, + + ["@function"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@function.builtin"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@function.macro"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@function.call"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@function.method"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@function.method.call"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + + ["@parameter"] = { fg = c.syntax.variable }, + ["@method"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@method.call"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@field"] = { fg = c.syntax.property, bold = true }, + ["@property"] = { fg = c.syntax.property, bold = true }, + ["@constructor"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + + ["@conditional"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@conditional.ternary"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@repeat"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@label"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@operator"] = vim.tbl_extend("force", { fg = c.syntax.operator }, bold_kw), + ["@keyword"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@keyword.function"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@keyword.operator"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@keyword.return"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@keyword.import"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@keyword.export"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@exception"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + + ["@variable"] = { fg = c.syntax.variable }, + ["@variable.builtin"] = { fg = c.syntax.constant, bold = true }, + ["@variable.parameter"] = { fg = c.syntax.variable }, + ["@variable.member"] = { fg = c.syntax.property, bold = true }, + + ["@type"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@type.qualifier"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@type.builtin"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@type.definition"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + + ["@storageclass"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@structure"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@namespace"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@module"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@include"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@preproc"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@debug"] = { fg = c.syntax.property, bold = true }, + + ["@tag"] = { fg = c.syntax.keyword, bold = true }, + ["@tag.attribute"] = { fg = c.syntax.property }, + ["@tag.delimiter"] = { fg = c.fg.muted }, + + ["@punctuation"] = { fg = c.fg.secondary }, + ["@punctuation.bracket"] = { fg = c.fg.secondary }, + ["@punctuation.delimiter"] = { fg = c.fg.secondary }, + ["@punctuation.special"] = { fg = c.syntax.property }, + + -- ============================================================ + -- LSP semantic tokens + -- ============================================================ + ["@lsp.type.comment"] = vim.tbl_extend("force", { fg = c.syntax.comment }, italic_comment), + ["@lsp.type.namespace"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@lsp.type.type"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@lsp.type.class"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@lsp.type.enum"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@lsp.type.interface"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@lsp.type.struct"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@lsp.type.typeParameter"] = vim.tbl_extend("force", { fg = c.syntax.type }, bold_ty), + ["@lsp.type.parameter"] = { fg = c.syntax.variable }, + ["@lsp.type.variable"] = { fg = c.syntax.variable }, + ["@lsp.type.property"] = { fg = c.syntax.property, bold = true }, + ["@lsp.type.enumMember"] = { fg = c.syntax.constant, bold = true }, + ["@lsp.type.function"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@lsp.type.method"] = vim.tbl_extend("force", { fg = c.syntax["function"] }, bold_fn), + ["@lsp.type.macro"] = vim.tbl_extend("force", { fg = c.syntax.keyword }, bold_kw), + ["@lsp.type.decorator"] = { fg = c.syntax.property, bold = true }, + + ["@lsp.mod.deprecated"] = { strikethrough = true }, + ["@lsp.mod.readonly"] = { fg = c.syntax.constant }, + ["@lsp.mod.defaultLibrary"] = { fg = c.syntax.constant }, + + -- ============================================================ + -- Diagnostics + -- ============================================================ + DiagnosticError = { fg = c.special.error }, + DiagnosticWarn = { fg = c.special.warning }, + DiagnosticInfo = { fg = c.special.info }, + DiagnosticHint = { fg = c.special.hint }, + DiagnosticOk = { fg = c.special.success }, + + DiagnosticVirtualTextError = { fg = c.special.error, italic = true }, + DiagnosticVirtualTextWarn = { fg = c.special.warning, italic = true }, + DiagnosticVirtualTextInfo = { fg = c.special.info, italic = true }, + DiagnosticVirtualTextHint = { fg = c.special.hint, italic = true }, + DiagnosticVirtualTextOk = { fg = c.special.success, italic = true }, + + DiagnosticUnderlineError = { sp = c.special.error, undercurl = true }, + DiagnosticUnderlineWarn = { sp = c.special.warning, undercurl = true }, + DiagnosticUnderlineInfo = { sp = c.special.info, undercurl = true }, + DiagnosticUnderlineHint = { sp = c.special.hint, undercurl = true }, + DiagnosticUnderlineOk = { sp = c.special.success, undercurl = true }, + + DiagnosticFloatingError = { fg = c.special.error }, + DiagnosticFloatingWarn = { fg = c.special.warning }, + DiagnosticFloatingInfo = { fg = c.special.info }, + DiagnosticFloatingHint = { fg = c.special.hint }, + DiagnosticFloatingOk = { fg = c.special.success }, + + DiagnosticSignError = { fg = c.special.error }, + DiagnosticSignWarn = { fg = c.special.warning }, + DiagnosticSignInfo = { fg = c.special.info }, + DiagnosticSignHint = { fg = c.special.hint }, + DiagnosticSignOk = { fg = c.special.success }, + + -- ============================================================ + -- LSP + -- ============================================================ + LspReferenceText = { bg = c.bg.selection }, + LspReferenceRead = { bg = c.bg.selection }, + LspReferenceWrite = { bg = c.bg.selection }, + LspSignatureActiveParameter = { fg = c.special.warning, bold = true }, + LspCodeLens = { fg = c.fg.muted, italic = true }, + LspCodeLensSeparator = { fg = c.fg.muted }, + LspInlayHint = { fg = c.fg.muted, italic = true }, + + -- ============================================================ + -- Git (built-in) + -- ============================================================ + diffAdded = { fg = c.special.diff_add }, + diffRemoved = { fg = c.special.diff_delete }, + diffChanged = { fg = c.special.diff_change }, + diffOldFile = { fg = c.special.diff_delete }, + diffNewFile = { fg = c.special.diff_add }, + diffFile = { fg = c.fg.accent }, + diffLine = { fg = c.fg.muted }, + diffIndexLine = { fg = c.fg.accent }, + + -- ============================================================ + -- Plugin: GitSigns + -- ============================================================ + GitSignsAdd = { fg = c.special.diff_add }, + GitSignsChange = { fg = c.special.diff_change }, + GitSignsDelete = { fg = c.special.diff_delete }, + GitSignsAddNr = { fg = c.special.diff_add }, + GitSignsChangeNr = { fg = c.special.diff_change }, + GitSignsDeleteNr = { fg = c.special.diff_delete }, + GitSignsAddLn = { bg = "#1a3a1a" }, + GitSignsChangeLn = { bg = "#3a3a1a" }, + GitSignsDeleteLn = { bg = "#3a1a1a" }, + GitSignsCurrentLineBlame = { fg = c.fg.muted, italic = true }, + + -- ============================================================ + -- Plugin: Telescope + -- ============================================================ + TelescopeBorder = { fg = c.fg.accent, bg = c.bg.float }, + TelescopeNormal = { fg = c.fg.primary, bg = c.bg.float }, + TelescopeTitle = { fg = c.fg.accent, bold = true }, + TelescopePromptBorder = { fg = c.fg.accent, bg = c.bg.float }, + TelescopePromptNormal = { fg = c.fg.primary, bg = c.bg.float }, + TelescopePromptTitle = { fg = c.syntax.keyword, bold = true }, + TelescopePromptPrefix = { fg = c.syntax.keyword }, + TelescopeResultsBorder = { fg = c.fg.accent, bg = c.bg.float }, + TelescopeResultsNormal = { fg = c.fg.primary, bg = c.bg.float }, + TelescopeResultsTitle = { fg = c.fg.accent, bold = true }, + TelescopePreviewBorder = { fg = c.fg.accent, bg = c.bg.float }, + TelescopePreviewNormal = { fg = c.fg.primary, bg = c.bg.float }, + TelescopePreviewTitle = { fg = c.syntax["function"], bold = true }, + TelescopeSelection = { fg = c.fg.primary, bg = c.bg.selection }, + TelescopeSelectionCaret = { fg = c.syntax.keyword }, + TelescopeMatching = { fg = c.special.warning, bold = true }, + + -- ============================================================ + -- Plugin: NvimTree + -- ============================================================ + NvimTreeNormal = { fg = c.fg.primary, bg = c.bg.secondary }, + NvimTreeNormalNC = { fg = c.fg.primary, bg = c.bg.secondary }, + NvimTreeRootFolder = { fg = c.syntax.keyword, bold = true }, + NvimTreeFolderName = { fg = c.syntax["function"] }, + NvimTreeFolderIcon = { fg = c.fg.accent }, + NvimTreeOpenedFolderName = { fg = c.syntax["function"], bold = true }, + NvimTreeEmptyFolderName = { fg = c.fg.muted }, + NvimTreeIndentMarker = { fg = c.bg.tertiary }, + NvimTreeGitDirty = { fg = c.special.diff_change }, + NvimTreeGitNew = { fg = c.special.diff_add }, + NvimTreeGitDeleted = { fg = c.special.diff_delete }, + NvimTreeGitStaged = { fg = c.special.success }, + NvimTreeSpecialFile = { fg = c.syntax.keyword, underline = true }, + NvimTreeImageFile = { fg = c.fg.secondary }, + NvimTreeSymlink = { fg = c.fg.accent }, + NvimTreeWinSeparator = { fg = c.bg.tertiary, bg = c.bg.secondary }, + + -- ============================================================ + -- Plugin: Neo-tree + -- ============================================================ + NeoTreeNormal = { fg = c.fg.primary, bg = c.bg.secondary }, + NeoTreeNormalNC = { fg = c.fg.primary, bg = c.bg.secondary }, + NeoTreeRootName = { fg = c.syntax.keyword, bold = true }, + NeoTreeDirectoryName = { fg = c.syntax["function"] }, + NeoTreeDirectoryIcon = { fg = c.fg.accent }, + NeoTreeFileName = { fg = c.fg.primary }, + NeoTreeFileIcon = { fg = c.fg.secondary }, + NeoTreeGitAdded = { fg = c.special.diff_add }, + NeoTreeGitModified = { fg = c.special.diff_change }, + NeoTreeGitDeleted = { fg = c.special.diff_delete }, + NeoTreeGitConflict = { fg = c.special.error }, + NeoTreeGitUntracked = { fg = c.fg.muted }, + NeoTreeIndentMarker = { fg = c.bg.tertiary }, + NeoTreeWinSeparator = { fg = c.bg.tertiary, bg = c.bg.secondary }, + + -- ============================================================ + -- Plugin: nvim-cmp + -- ============================================================ + CmpItemAbbr = { fg = c.fg.primary }, + CmpItemAbbrDeprecated = { fg = c.fg.muted, strikethrough = true }, + CmpItemAbbrMatch = { fg = c.special.warning, bold = true }, + CmpItemAbbrMatchFuzzy = { fg = c.special.warning, bold = true }, + CmpItemKind = { fg = c.fg.accent }, + CmpItemMenu = { fg = c.fg.muted }, + CmpItemKindClass = { fg = c.syntax.type }, + CmpItemKindColor = { fg = c.syntax.number }, + CmpItemKindConstant = { fg = c.syntax.constant }, + CmpItemKindConstructor = { fg = c.syntax["function"] }, + CmpItemKindEnum = { fg = c.syntax.type }, + CmpItemKindEnumMember = { fg = c.syntax.constant }, + CmpItemKindEvent = { fg = c.syntax.keyword }, + CmpItemKindField = { fg = c.syntax.property }, + CmpItemKindFile = { fg = c.fg.secondary }, + CmpItemKindFolder = { fg = c.syntax["function"] }, + CmpItemKindFunction = { fg = c.syntax["function"] }, + CmpItemKindInterface = { fg = c.syntax.type }, + CmpItemKindKeyword = { fg = c.syntax.keyword }, + CmpItemKindMethod = { fg = c.syntax["function"] }, + CmpItemKindModule = { fg = c.syntax.type }, + CmpItemKindOperator = { fg = c.syntax.operator }, + CmpItemKindProperty = { fg = c.syntax.property }, + CmpItemKindReference = { fg = c.fg.accent }, + CmpItemKindSnippet = { fg = c.syntax.string }, + CmpItemKindStruct = { fg = c.syntax.type }, + CmpItemKindText = { fg = c.fg.primary }, + CmpItemKindTypeParameter = { fg = c.syntax.type }, + CmpItemKindUnit = { fg = c.syntax.number }, + CmpItemKindValue = { fg = c.syntax.constant }, + CmpItemKindVariable = { fg = c.syntax.variable }, + + -- ============================================================ + -- Plugin: indent-blankline + -- ============================================================ + IndentBlanklineChar = { fg = c.bg.tertiary, nocombine = true }, + IndentBlanklineContextChar = { fg = c.fg.muted, nocombine = true }, + IndentBlanklineContextStart = { sp = c.fg.muted, underline = true }, + IblIndent = { fg = c.bg.tertiary, nocombine = true }, + IblScope = { fg = c.fg.muted, nocombine = true }, + + -- ============================================================ + -- Plugin: which-key + -- ============================================================ + WhichKey = { fg = c.syntax.keyword }, + WhichKeyGroup = { fg = c.fg.accent }, + WhichKeyDesc = { fg = c.fg.primary }, + WhichKeySeparator = { fg = c.fg.muted }, + WhichKeyFloat = { bg = c.bg.float }, + WhichKeyValue = { fg = c.fg.muted }, + + -- ============================================================ + -- Plugin: Lazy.nvim + -- ============================================================ + LazyButton = { fg = c.fg.primary, bg = c.bg.secondary }, + LazyButtonActive = { fg = c.bg.primary, bg = c.fg.accent, bold = true }, + LazyComment = { fg = c.fg.muted }, + LazyCommit = { fg = c.fg.accent }, + LazyCommitIssue = { fg = c.syntax.number }, + LazyCommitScope = { fg = c.syntax.property }, + LazyCommitType = { fg = c.syntax.keyword }, + LazyDimmed = { fg = c.fg.muted }, + LazyDir = { fg = c.syntax["function"] }, + LazyH1 = { fg = c.bg.primary, bg = c.fg.accent, bold = true }, + LazyH2 = { fg = c.fg.accent, bold = true }, + LazyNoCond = { fg = c.special.error }, + LazyNormal = { fg = c.fg.primary, bg = c.bg.float }, + LazyProgressDone = { fg = c.special.success }, + LazyProgressTodo = { fg = c.fg.muted }, + LazyProp = { fg = c.fg.muted }, + LazyReasonCmd = { fg = c.syntax.keyword }, + LazyReasonEvent = { fg = c.syntax.number }, + LazyReasonFt = { fg = c.syntax.type }, + LazyReasonImport = { fg = c.syntax.keyword }, + LazyReasonKeys = { fg = c.syntax.string }, + LazyReasonPlugin = { fg = c.syntax["function"] }, + LazyReasonSource = { fg = c.syntax.property }, + LazyReasonStart = { fg = c.special.success }, + LazySpecial = { fg = c.fg.accent }, + LazyTaskOutput = { fg = c.fg.primary }, + LazyUrl = { fg = c.syntax["function"], underline = true }, + LazyValue = { fg = c.syntax.string }, + + -- ============================================================ + -- Plugin: Mason + -- ============================================================ + MasonHeader = { fg = c.bg.primary, bg = c.fg.accent, bold = true }, + MasonHeaderSecondary = { fg = c.bg.primary, bg = c.syntax.keyword, bold = true }, + MasonHighlight = { fg = c.fg.accent }, + MasonHighlightBlock = { fg = c.bg.primary, bg = c.fg.accent }, + MasonHighlightBlockBold = { fg = c.bg.primary, bg = c.fg.accent, bold = true }, + MasonHighlightSecondary = { fg = c.syntax.keyword }, + MasonMuted = { fg = c.fg.muted }, + MasonMutedBlock = { fg = c.fg.primary, bg = c.bg.secondary }, + + -- ============================================================ + -- Plugin: Copilot + -- ============================================================ + CopilotSuggestion = { fg = "#999999", italic = true }, + CopilotAnnotation = { fg = "#999999", italic = true }, + + -- ============================================================ + -- Plugin: nvim-notify + -- ============================================================ + NotifyERRORBorder = { fg = c.special.error }, + NotifyWARNBorder = { fg = c.special.warning }, + NotifyINFOBorder = { fg = c.special.info }, + NotifyDEBUGBorder = { fg = c.fg.muted }, + NotifyTRACEBorder = { fg = c.syntax.type }, + NotifyERRORIcon = { fg = c.special.error }, + NotifyWARNIcon = { fg = c.special.warning }, + NotifyINFOIcon = { fg = c.special.info }, + NotifyDEBUGIcon = { fg = c.fg.muted }, + NotifyTRACEIcon = { fg = c.syntax.type }, + NotifyERRORTitle = { fg = c.special.error }, + NotifyWARNTitle = { fg = c.special.warning }, + NotifyINFOTitle = { fg = c.special.info }, + NotifyDEBUGTitle = { fg = c.fg.muted }, + NotifyTRACETitle = { fg = c.syntax.type }, + NotifyERRORBody = { fg = c.fg.primary }, + NotifyWARNBody = { fg = c.fg.primary }, + NotifyINFOBody = { fg = c.fg.primary }, + NotifyDEBUGBody = { fg = c.fg.primary }, + NotifyTRACEBody = { fg = c.fg.primary }, + + -- ============================================================ + -- Plugin: noice.nvim + -- ============================================================ + NoiceCmdline = { fg = c.fg.primary }, + NoiceCmdlineIcon = { fg = c.fg.accent }, + NoiceCmdlineIconSearch = { fg = c.special.warning }, + NoiceCmdlinePopup = { fg = c.fg.primary, bg = c.bg.float }, + NoiceCmdlinePopupBorder = { fg = c.fg.accent }, + NoiceCmdlinePopupBorderSearch = { fg = c.special.warning }, + NoiceConfirm = { fg = c.fg.primary, bg = c.bg.float }, + NoiceConfirmBorder = { fg = c.fg.accent }, + NoiceMini = { fg = c.fg.primary, bg = c.bg.secondary }, + NoicePopup = { fg = c.fg.primary, bg = c.bg.float }, + NoicePopupBorder = { fg = c.fg.accent }, + NoiceScrollbar = { bg = c.bg.secondary }, + NoiceScrollbarThumb = { bg = c.fg.muted }, + + -- ============================================================ + -- Plugin: bufferline.nvim + -- ============================================================ + BufferLineFill = { bg = c.bg.secondary }, + BufferLineBackground = { fg = c.fg.muted, bg = c.bg.secondary }, + BufferLineBuffer = { fg = c.fg.muted, bg = c.bg.secondary }, + BufferLineBufferSelected = { fg = c.fg.primary, bg = c.bg.primary, bold = true }, + BufferLineBufferVisible = { fg = c.fg.secondary, bg = c.bg.tertiary }, + BufferLineCloseButton = { fg = c.fg.muted, bg = c.bg.secondary }, + BufferLineCloseButtonSelected = { fg = c.special.error, bg = c.bg.primary }, + BufferLineCloseButtonVisible = { fg = c.fg.muted, bg = c.bg.tertiary }, + BufferLineIndicatorSelected = { fg = c.fg.accent, bg = c.bg.primary }, + BufferLineIndicatorVisible = { fg = c.bg.tertiary, bg = c.bg.tertiary }, + BufferLineModified = { fg = c.special.warning, bg = c.bg.secondary }, + BufferLineModifiedSelected = { fg = c.special.warning, bg = c.bg.primary }, + BufferLineModifiedVisible = { fg = c.special.warning, bg = c.bg.tertiary }, + BufferLineSeparator = { fg = c.bg.secondary, bg = c.bg.secondary }, + BufferLineSeparatorSelected = { fg = c.bg.secondary, bg = c.bg.primary }, + BufferLineSeparatorVisible = { fg = c.bg.secondary, bg = c.bg.tertiary }, + BufferLineTab = { fg = c.fg.muted, bg = c.bg.secondary }, + BufferLineTabSelected = { fg = c.fg.accent, bg = c.bg.primary, bold = true }, + BufferLineTabClose = { fg = c.special.error, bg = c.bg.secondary }, + + -- ============================================================ + -- Plugin: lualine.nvim + -- ============================================================ + lualine_a_normal = { fg = c.bg.primary, bg = c.syntax["function"], bold = true }, + lualine_b_normal = { fg = c.fg.primary, bg = c.bg.tertiary }, + lualine_c_normal = { fg = c.fg.secondary, bg = c.bg.secondary }, + lualine_a_insert = { fg = c.bg.primary, bg = c.syntax.keyword, bold = true }, + lualine_a_visual = { fg = c.bg.primary, bg = c.syntax.type, bold = true }, + lualine_a_replace = { fg = c.bg.primary, bg = c.special.error, bold = true }, + lualine_a_command = { fg = c.bg.primary, bg = c.syntax.number, bold = true }, + lualine_a_inactive = { fg = c.fg.muted, bg = c.bg.secondary }, + lualine_b_inactive = { fg = c.fg.muted, bg = c.bg.secondary }, + lualine_c_inactive = { fg = c.fg.muted, bg = c.bg.secondary }, + + -- ============================================================ + -- Plugin: dashboard-nvim + -- ============================================================ + DashboardHeader = { fg = c.syntax.keyword }, + DashboardCenter = { fg = c.fg.accent }, + DashboardFooter = { fg = c.fg.muted }, + DashboardShortCut = { fg = c.syntax["function"] }, + + -- ============================================================ + -- Plugin: alpha-nvim + -- ============================================================ + AlphaHeader = { fg = c.syntax.keyword }, + AlphaButtons = { fg = c.fg.accent }, + AlphaShortcut = { fg = c.syntax["function"] }, + AlphaFooter = { fg = c.fg.muted, italic = true }, + + -- ============================================================ + -- Plugin: trouble.nvim + -- ============================================================ + TroubleText = { fg = c.fg.primary }, + TroubleCount = { fg = c.syntax.keyword, bg = c.bg.tertiary }, + TroubleNormal = { fg = c.fg.primary, bg = c.bg.float }, + + -- ============================================================ + -- Markdown + -- ============================================================ + markdownH1 = { fg = c.syntax.keyword, bold = true }, + markdownH2 = { fg = c.syntax["function"], bold = true }, + markdownH3 = { fg = c.syntax.type, bold = true }, + markdownH4 = { fg = c.syntax.number, bold = true }, + markdownH5 = { fg = c.syntax.property, bold = true }, + markdownH6 = { fg = c.fg.accent, bold = true }, + markdownCode = { fg = c.syntax.string, bg = c.bg.secondary }, + markdownCodeBlock = { fg = c.syntax.string }, + markdownBold = { bold = true }, + markdownItalic = { italic = true }, + markdownLinkText = { fg = c.fg.accent, underline = true }, + markdownUrl = { fg = c.syntax["function"], underline = true }, + } +end + +return M diff --git a/lua/cargdev-cyberpunk/init.lua b/lua/cargdev-cyberpunk/init.lua index b6cb63b..88fffd6 100644 --- a/lua/cargdev-cyberpunk/init.lua +++ b/lua/cargdev-cyberpunk/init.lua @@ -1,219 +1,86 @@ +---@class CargdevCyberpunk +---@field config CargdevCyberpunkConfig +---@field colors CargdevCyberpunkPalette local M = {} -function M.setup(opts) - opts = opts or {} +---Load the colorscheme +function M.load() + if vim.g.colors_name then + vim.cmd("hi clear") + end + + if vim.fn.exists("syntax_on") then + vim.cmd("syntax reset") + end + + vim.o.termguicolors = true + vim.g.colors_name = "cargdev-cyberpunk" + M.apply_highlights() + M.apply_terminal_colors() end +---Setup the colorscheme with options +---@param opts? CargdevCyberpunkConfig +function M.setup(opts) + local config = require("cargdev-cyberpunk.config") + config.setup(opts) + + -- Apply custom color overrides if provided + if opts and opts.colors and next(opts.colors) then + local colors = require("cargdev-cyberpunk.colors") + colors.override(opts.colors) + end + + M.load() +end + +---Apply all highlight groups function M.apply_highlights() - local colors = { - bg = { - primary = "#002B36", - secondary = "#003B46", - tertiary = "#004B56", - float = "#003B46", - highlight = "#112233", - selection = "#44475A", - }, - - fg = { - primary = "#E0E0E0", - secondary = "#B8B8B8", - muted = "#888888", - accent = "#8BE9FD", - }, - - syntax = { - keyword = "#FF79C6", - ["function"] = "#50FA7B", - string = "#FFFFFF", - number = "#FFB86C", - comment = "#666666", - type = "#BD93F9", - constant = "#FFB86C", - operator = "#FF79C6", - variable = "#BD93F9", - property = "#50FA7B", - }, - - special = { - error = "#FF5555", - warning = "#FFB86C", - info = "#8BE9FD", - success = "#50FA7B", - diff_add = "#50FA7B", - diff_delete = "#FF5555", - diff_change = "#FFB86C", - } - } - - local groups = { - Normal = { fg = colors.fg.primary, bg = colors.bg.primary }, - NormalFloat = { fg = colors.fg.primary, bg = colors.bg.float }, - NormalNC = { fg = colors.fg.primary, bg = colors.bg.primary }, - - LineNr = { fg = colors.fg.muted }, - LineNrAbove = { fg = colors.fg.muted }, - LineNrBelow = { fg = colors.fg.muted }, - CursorLineNr = { fg = colors.fg.accent, bold = true }, - - Cursor = { fg = colors.bg.primary, bg = colors.fg.accent }, - CursorLine = { bg = colors.bg.highlight }, - CursorColumn = { bg = colors.bg.highlight }, - - Visual = { bg = colors.bg.selection }, - VisualNOS = { bg = colors.bg.selection }, - - Search = { fg = colors.bg.primary, bg = colors.special.warning }, - IncSearch = { fg = colors.bg.primary, bg = colors.syntax.number }, - - StatusLine = { fg = colors.fg.primary, bg = colors.bg.secondary }, - StatusLineNC = { fg = colors.fg.muted, bg = colors.bg.secondary }, - StatusLineTerm = { fg = colors.fg.primary, bg = colors.bg.secondary }, - StatusLineTermNC = { fg = colors.fg.muted, bg = colors.bg.secondary }, - - TabLine = { fg = colors.fg.muted, bg = colors.bg.secondary }, - TabLineFill = { bg = colors.bg.secondary }, - TabLineSel = { fg = colors.fg.accent, bg = colors.bg.tertiary, bold = true }, - - WinBar = { fg = colors.fg.primary, bg = colors.bg.primary }, - WinBarNC = { fg = colors.fg.muted, bg = colors.bg.primary }, - - Pmenu = { fg = colors.fg.primary, bg = colors.bg.float }, - PmenuSel = { fg = colors.fg.primary, bg = colors.fg.accent }, - PmenuSbar = { bg = colors.bg.float }, - PmenuThumb = { bg = colors.bg.highlight }, - - Comment = { fg = colors.syntax.comment, italic = true }, - String = { fg = colors.syntax.string }, - Character = { fg = colors.syntax.string }, - Number = { fg = colors.syntax.number }, - Boolean = { fg = colors.syntax.constant }, - Float = { fg = colors.syntax.number }, - - Identifier = { fg = colors.syntax.variable }, - ["Function"] = { fg = colors.syntax["function"], bold = true }, - Statement = { fg = colors.syntax.keyword, bold = true }, - Conditional = { fg = colors.syntax.keyword, bold = true }, - Repeat = { fg = colors.syntax.keyword, bold = true }, - Label = { fg = colors.syntax.keyword, bold = true }, - Operator = { fg = colors.syntax.operator, bold = true }, - Keyword = { fg = colors.syntax.keyword, bold = true }, - Exception = { fg = colors.syntax.keyword, bold = true }, - - PreProc = { fg = colors.syntax.keyword, bold = true }, - Include = { fg = colors.syntax.keyword, bold = true }, - Define = { fg = colors.syntax.keyword, bold = true }, - Macro = { fg = colors.syntax.keyword, bold = true }, - PreCondit = { fg = colors.syntax.keyword, bold = true }, - - Type = { fg = colors.syntax.type, bold = true }, - StorageClass = { fg = colors.syntax.keyword, bold = true }, - Structure = { fg = colors.syntax.type, bold = true }, - Typedef = { fg = colors.syntax.type, bold = true }, - - Special = { fg = colors.syntax.property }, - SpecialChar = { fg = colors.syntax.property }, - Tag = { fg = colors.syntax.property }, - Delimiter = { fg = colors.syntax.operator }, - SpecialComment = { fg = colors.syntax.comment }, - Debug = { fg = colors.syntax.property }, - - Underlined = { underline = true }, - Ignore = { fg = colors.fg.muted }, - Error = { fg = colors.special.error, bold = true }, - Todo = { fg = colors.special.warning, bold = true }, - - DiffAdd = { fg = colors.special.diff_add }, - DiffChange = { fg = colors.special.diff_change }, - DiffDelete = { fg = colors.special.diff_delete }, - DiffText = { fg = colors.fg.primary, bg = colors.special.diff_change }, - - SpellBad = { sp = colors.special.error, underline = true }, - SpellCap = { sp = colors.special.warning, underline = true }, - SpellLocal = { sp = colors.special.info, underline = true }, - SpellRare = { sp = colors.special.success, underline = true }, - - ["@text"] = { fg = colors.fg.primary }, - ["@text.strong"] = { bold = true }, - ["@text.emphasis"] = { italic = true }, - ["@text.underline"] = { underline = true }, - ["@text.strike"] = { strikethrough = true }, - ["@text.literal"] = { fg = colors.syntax.string }, - ["@text.uri"] = { fg = colors.syntax["function"], underline = true }, - - ["@comment"] = { fg = colors.syntax.comment, italic = true }, - ["@comment.documentation"] = { fg = colors.syntax.comment }, - - ["@constant"] = { fg = colors.syntax.constant }, - ["@constant.builtin"] = { fg = colors.syntax.constant }, - ["@constant.macro"] = { fg = colors.syntax.constant }, - ["@define"] = { fg = colors.syntax.keyword }, - ["@macro"] = { fg = colors.syntax.keyword }, - ["@string"] = { fg = colors.syntax.string }, - ["@string.escape"] = { fg = colors.syntax.property }, - ["@string.special"] = { fg = colors.syntax.property }, - ["@character"] = { fg = colors.syntax.string }, - ["@character.special"] = { fg = colors.syntax.property }, - ["@number"] = { fg = colors.syntax.number }, - ["@boolean"] = { fg = colors.syntax.constant }, - ["@float"] = { fg = colors.syntax.number }, - - ["@function"] = { fg = colors.syntax["function"], bold = true }, - ["@function.builtin"] = { fg = colors.syntax["function"], bold = true }, - ["@function.macro"] = { fg = colors.syntax["function"], bold = true }, - ["@parameter"] = { fg = colors.syntax.variable }, - ["@method"] = { fg = colors.syntax["function"], bold = true }, - ["@field"] = { fg = colors.syntax.property, bold = true }, - ["@property"] = { fg = colors.syntax.property, bold = true }, - ["@constructor"] = { fg = colors.syntax["function"], bold = true }, - - ["@conditional"] = { fg = colors.syntax.keyword, bold = true }, - ["@repeat"] = { fg = colors.syntax.keyword, bold = true }, - ["@label"] = { fg = colors.syntax.keyword, bold = true }, - ["@operator"] = { fg = colors.syntax.operator, bold = true }, - ["@keyword"] = { fg = colors.syntax.keyword, bold = true }, - ["@exception"] = { fg = colors.syntax.keyword, bold = true }, - - ["@variable"] = { fg = colors.syntax.variable }, - ["@variable.builtin"] = { fg = colors.syntax.constant, bold = true }, - ["@type"] = { fg = colors.syntax.type, bold = true }, - ["@type.qualifier"] = { fg = colors.syntax.keyword, bold = true }, - ["@type.builtin"] = { fg = colors.syntax.type, bold = true }, - ["@type.definition"] = { fg = colors.syntax.type, bold = true }, - ["@storageclass"] = { fg = colors.syntax.keyword, bold = true }, - ["@structure"] = { fg = colors.syntax.type, bold = true }, - ["@namespace"] = { fg = colors.syntax.type, bold = true }, - ["@include"] = { fg = colors.syntax.keyword, bold = true }, - ["@preproc"] = { fg = colors.syntax.keyword, bold = true }, - ["@debug"] = { fg = colors.syntax.property, bold = true }, - ["@tag"] = { fg = colors.syntax.property, bold = true }, - - ["@lsp.type.comment"] = { fg = colors.syntax.comment, italic = true }, - ["@lsp.type.namespace"] = { fg = colors.syntax.type, bold = true }, - ["@lsp.type.type"] = { fg = colors.syntax.type, bold = true }, - ["@lsp.type.class"] = { fg = colors.syntax.type, bold = true }, - ["@lsp.type.enum"] = { fg = colors.syntax.type, bold = true }, - ["@lsp.type.interface"] = { fg = colors.syntax.type, bold = true }, - ["@lsp.type.struct"] = { fg = colors.syntax.type, bold = true }, - ["@lsp.type.parameter"] = { fg = colors.syntax.variable }, - ["@lsp.type.variable"] = { fg = colors.syntax.variable }, - ["@lsp.type.property"] = { fg = colors.syntax.property, bold = true }, - ["@lsp.type.enumMember"] = { fg = colors.syntax.constant, bold = true }, - ["@lsp.type.function"] = { fg = colors.syntax["function"], bold = true }, - ["@lsp.type.method"] = { fg = colors.syntax["function"], bold = true }, - ["@lsp.type.macro"] = { fg = colors.syntax.keyword, bold = true }, - ["@lsp.type.decorator"] = { fg = colors.syntax.property, bold = true }, - - CopilotSuggestion = { fg = "#999999", italic = true }, - CopilotAnnotation = { fg = "#999999", italic = true }, - CopilotSuggestionPrefix = { fg = "#999999", italic = true }, - CopilotSuggestionSuffix = { fg = "#999999", italic = true }, - } - + local colors = require("cargdev-cyberpunk.colors") + local config = require("cargdev-cyberpunk.config") + local highlights = require("cargdev-cyberpunk.highlights") + + local groups = highlights.get_groups(colors.palette, config.get()) + for group, settings in pairs(groups) do vim.api.nvim_set_hl(0, group, settings) end end -return M \ No newline at end of file +---Apply terminal colors +function M.apply_terminal_colors() + local config = require("cargdev-cyberpunk.config") + + if not config.get().terminal_colors then + return + end + + local colors = require("cargdev-cyberpunk.colors") + local c = colors.palette.terminal + + vim.g.terminal_color_0 = c.black + vim.g.terminal_color_1 = c.red + vim.g.terminal_color_2 = c.green + vim.g.terminal_color_3 = c.yellow + vim.g.terminal_color_4 = c.blue + vim.g.terminal_color_5 = c.magenta + vim.g.terminal_color_6 = c.cyan + vim.g.terminal_color_7 = c.white + vim.g.terminal_color_8 = c.bright_black + vim.g.terminal_color_9 = c.bright_red + vim.g.terminal_color_10 = c.bright_green + vim.g.terminal_color_11 = c.bright_yellow + vim.g.terminal_color_12 = c.bright_blue + vim.g.terminal_color_13 = c.bright_magenta + vim.g.terminal_color_14 = c.bright_cyan + vim.g.terminal_color_15 = c.bright_white +end + +---Get the color palette +---@return CargdevCyberpunkPalette +function M.get_colors() + return require("cargdev-cyberpunk.colors").get_palette() +end + +return M diff --git a/lua/cargdev-cyberpunk/plugin.lua b/lua/cargdev-cyberpunk/plugin.lua index 51cb9dc..d291e52 100644 --- a/lua/cargdev-cyberpunk/plugin.lua +++ b/lua/cargdev-cyberpunk/plugin.lua @@ -1,13 +1,17 @@ +---@class CargdevCyberpunkPlugin local M = {} M.name = "cargdev-cyberpunk.nvim" M.description = "A vibrant Neovim color scheme with cyberpunk aesthetics" -M.version = "1.0.0" +M.version = "1.1.0" M.author = "CargDev" M.license = "MIT" +M.repository = "https://github.com/yourusername/cargdev-cyberpunk.nvim" -function M.config() - require('cargdev-cyberpunk').setup() +---Plugin configuration for lazy.nvim +---@param opts? CargdevCyberpunkConfig +function M.config(opts) + require("cargdev-cyberpunk").setup(opts) end -return M \ No newline at end of file +return M diff --git a/selene.toml b/selene.toml new file mode 100644 index 0000000..74fc99e --- /dev/null +++ b/selene.toml @@ -0,0 +1,48 @@ +# Selene configuration for CargDev-Cyberpunk.nvim +# https://kampfkarren.github.io/selene/ + +std = "lua51+vim" + +[lints] +# Allow globals from Neovim +global_usage = "allow" +# Unused variables warnings +unused_variable = "warn" +# Empty if statements +empty_if = "warn" +# Deprecated features +deprecated = "warn" +# Dividing by zero +divide_by_zero = "warn" +# Duplicate keys in tables +duplicate_keys = "deny" +# If statements with the same body +if_same_then_else = "warn" +# Incorrect standard library usage +incorrect_standard_library_use = "deny" +# Manual table clone +manual_table_clone = "warn" +# Mismatched argument count +mismatched_arg_count = "warn" +# Multiple statements on one line +multiple_statements = "allow" +# Parentheses condition +parenthese_conditions = "warn" +# Shadowing +shadowing = "allow" +# Type checking +type_check_inside_call = "warn" +# Unbalanced assignments +unbalanced_assignments = "warn" +# Undefined variables +undefined_variable = "deny" +# Unreachable code +unreachable_code = "warn" +# Unscoped variables +unscoped_variables = "warn" +# Unused functions +unused_function = "warn" + +[config] +# Files to exclude from linting +exclude = [".git"] diff --git a/stylua.toml b/stylua.toml new file mode 100644 index 0000000..4f3f458 --- /dev/null +++ b/stylua.toml @@ -0,0 +1,13 @@ +# StyLua configuration for CargDev-Cyberpunk.nvim +# https://github.com/JohnnyMorganz/StyLua + +column_width = 120 +line_endings = "Unix" +indent_type = "Spaces" +indent_width = 2 +quote_style = "AutoPreferDouble" +call_parentheses = "Always" +collapse_simple_statement = "Never" + +[sort_requires] +enabled = false diff --git a/test/test_colors.lua b/test/test_colors.lua new file mode 100644 index 0000000..3895443 --- /dev/null +++ b/test/test_colors.lua @@ -0,0 +1,174 @@ +-- Test file for CargDev-Cyberpunk colorscheme +-- Run with: nvim --headless -c "lua dofile('test/test_colors.lua')" + +local function test_colors() + local ok, colors = pcall(require, "cargdev-cyberpunk.colors") + if not ok then + print("FAIL: Could not load colors module") + print(colors) + return false + end + + local palette = colors.palette + local tests_passed = 0 + local tests_failed = 0 + + -- Test palette structure + local required_categories = { "bg", "fg", "syntax", "special", "terminal" } + for _, category in ipairs(required_categories) do + if palette[category] then + tests_passed = tests_passed + 1 + print(string.format("PASS: palette.%s exists", category)) + else + tests_failed = tests_failed + 1 + print(string.format("FAIL: palette.%s is missing", category)) + end + end + + -- Test color format (should be hex colors) + local function is_valid_hex(color) + return type(color) == "string" and color:match("^#%x%x%x%x%x%x$") ~= nil + end + + for category, values in pairs(palette) do + for key, value in pairs(values) do + if is_valid_hex(value) then + tests_passed = tests_passed + 1 + else + tests_failed = tests_failed + 1 + print(string.format("FAIL: Invalid color format for %s.%s: %s", category, key, tostring(value))) + end + end + end + + print(string.format("\nResults: %d passed, %d failed", tests_passed, tests_failed)) + return tests_failed == 0 +end + +local function test_config() + local ok, config = pcall(require, "cargdev-cyberpunk.config") + if not ok then + print("FAIL: Could not load config module") + print(config) + return false + end + + config.setup({}) + local cfg = config.get() + + local tests_passed = 0 + local tests_failed = 0 + + -- Test default config values + local expected_defaults = { + transparent = false, + italic_comments = true, + bold_keywords = true, + bold_functions = true, + bold_types = true, + terminal_colors = true, + } + + for key, expected in pairs(expected_defaults) do + if cfg[key] == expected then + tests_passed = tests_passed + 1 + print(string.format("PASS: config.%s = %s", key, tostring(expected))) + else + tests_failed = tests_failed + 1 + print(string.format("FAIL: config.%s expected %s, got %s", key, tostring(expected), tostring(cfg[key]))) + end + end + + print(string.format("\nResults: %d passed, %d failed", tests_passed, tests_failed)) + return tests_failed == 0 +end + +local function test_highlights() + local ok, highlights = pcall(require, "cargdev-cyberpunk.highlights") + if not ok then + print("FAIL: Could not load highlights module") + print(highlights) + return false + end + + local colors = require("cargdev-cyberpunk.colors") + local config = require("cargdev-cyberpunk.config") + config.setup({}) + + local groups = highlights.get_groups(colors.palette, config.get()) + + local tests_passed = 0 + local tests_failed = 0 + + -- Test essential highlight groups exist + local essential_groups = { + "Normal", "NormalFloat", "Comment", "String", "Function", + "Keyword", "Type", "DiagnosticError", "DiagnosticWarn", + "TelescopeBorder", "NvimTreeNormal", "GitSignsAdd", + } + + for _, group in ipairs(essential_groups) do + if groups[group] then + tests_passed = tests_passed + 1 + print(string.format("PASS: Highlight group '%s' exists", group)) + else + tests_failed = tests_failed + 1 + print(string.format("FAIL: Highlight group '%s' is missing", group)) + end + end + + print(string.format("\nResults: %d passed, %d failed", tests_passed, tests_failed)) + return tests_failed == 0 +end + +local function test_init() + local ok, cyberpunk = pcall(require, "cargdev-cyberpunk") + if not ok then + print("FAIL: Could not load main module") + print(cyberpunk) + return false + end + + local tests_passed = 0 + local tests_failed = 0 + + -- Test module functions exist + local expected_functions = { "setup", "load", "apply_highlights", "apply_terminal_colors", "get_colors" } + + for _, func_name in ipairs(expected_functions) do + if type(cyberpunk[func_name]) == "function" then + tests_passed = tests_passed + 1 + print(string.format("PASS: Function '%s' exists", func_name)) + else + tests_failed = tests_failed + 1 + print(string.format("FAIL: Function '%s' is missing or not a function", func_name)) + end + end + + print(string.format("\nResults: %d passed, %d failed", tests_passed, tests_failed)) + return tests_failed == 0 +end + +-- Run all tests +print("=== Testing CargDev-Cyberpunk Colorscheme ===\n") + +print("--- Testing Colors Module ---") +local colors_ok = test_colors() + +print("\n--- Testing Config Module ---") +local config_ok = test_config() + +print("\n--- Testing Highlights Module ---") +local highlights_ok = test_highlights() + +print("\n--- Testing Main Module ---") +local init_ok = test_init() + +print("\n=== Test Summary ===") +if colors_ok and config_ok and highlights_ok and init_ok then + print("All tests passed!") + vim.cmd("qa!") +else + print("Some tests failed!") + vim.cmd("cq!") +end diff --git a/vim.toml b/vim.toml new file mode 100644 index 0000000..0ba56fe --- /dev/null +++ b/vim.toml @@ -0,0 +1,56 @@ +# Vim standard library for Selene +# Defines Neovim global variables and functions + +[vim] +any = true + +[vim.api] +any = true + +[vim.fn] +any = true + +[vim.g] +any = true + +[vim.o] +any = true + +[vim.opt] +any = true + +[vim.cmd] +any = true + +[vim.loop] +any = true + +[vim.lsp] +any = true + +[vim.treesitter] +any = true + +[vim.diagnostic] +any = true + +[vim.keymap] +any = true + +[vim.tbl_extend] +any = true + +[vim.tbl_deep_extend] +any = true + +[vim.deepcopy] +any = true + +[vim.inspect] +any = true + +[vim.notify] +any = true + +[vim.schedule] +any = true