mirror of
https://github.com/obsqrbtz/clrsync.git
synced 2026-04-09 04:29:04 +03:00
Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7638284616 | |||
| 25fbc7852d | |||
| a200d70b14 | |||
| f3e842d7d2 | |||
| 87406dc8dd | |||
| 67eaa69851 | |||
| 6badab9024 | |||
| 0221f06d5c | |||
| b5f3507b6e | |||
| 3277873d0c |
@@ -1,6 +1,6 @@
|
||||
# Maintainer: Daniel Dada <dan@binarygoose.dev>
|
||||
pkgname=clrsync
|
||||
pkgver=1.1.0
|
||||
pkgver=1.1.2
|
||||
pkgrel=1
|
||||
pkgdesc="Color scheme manager"
|
||||
arch=('x86_64')
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.25)
|
||||
project(clrsync VERSION 1.1.0 LANGUAGES CXX)
|
||||
project(clrsync VERSION 1.1.2 LANGUAGES CXX)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
|
||||
62
README.md
62
README.md
@@ -41,6 +41,7 @@ A theme management tool for synchronizing color schemes across multiple applicat
|
||||
- **CLI & GUI**: Choose between a command-line interface or a graphical editor
|
||||
- **Live Reload**: Define post-apply hooks (configurable per template)
|
||||
- **Flexible Color Formats**: Support for HEX, RGB, HSL with multi-component access (e.g., `{color.r}`, `{color.hex}`, `{color.hsl}`)
|
||||
- **Color generation**: integration with `hellwal` and `matugen`
|
||||
|
||||
## Installation
|
||||
|
||||
@@ -421,6 +422,8 @@ Format colors using dot notation:
|
||||
|
||||
### CLI
|
||||
|
||||
#### Basic Commands
|
||||
|
||||
List available themes:
|
||||
```bash
|
||||
clrsync_cli --list-themes
|
||||
@@ -451,6 +454,64 @@ Use a custom config file:
|
||||
clrsync_cli --config /path/to/config.toml --apply
|
||||
```
|
||||
|
||||
#### Palette Generation
|
||||
|
||||
>
|
||||
> Requires hellwal and/or matugen installed
|
||||
|
||||
Generate a palette from an image:
|
||||
```bash
|
||||
clrsync_cli --generate /path/to/image.png
|
||||
```
|
||||
|
||||
Generate a palette from a color (hex):
|
||||
```bash
|
||||
clrsync_cli --generate-color "#B44242" --generator matugen
|
||||
```
|
||||
|
||||
#### Generator Options
|
||||
|
||||
**Hellwal Generator** (default):
|
||||
```bash
|
||||
clrsync_cli --generate image.png --generator hellwal --hellwal-neon --hellwal-dark
|
||||
```
|
||||
|
||||
Available hellwal options:
|
||||
- `--hellwal-neon` - Enable neon mode
|
||||
- `--hellwal-dark` - Prefer dark palettes
|
||||
- `--hellwal-light` - Prefer light palettes
|
||||
- `--hellwal-color` - Enable color mode
|
||||
- `--hellwal-invert` - Invert colors
|
||||
- `--hellwal-dark-offset <float>` - Dark offset (default: 0.0)
|
||||
- `--hellwal-bright-offset <float>` - Bright offset (default: 0.0)
|
||||
- `--hellwal-gray-scale <float>` - Gray scale factor (default: 0.0)
|
||||
|
||||
**Matugen Generator**:
|
||||
```bash
|
||||
clrsync_cli --generate image.png --generator matugen --matugen-mode dark --matugen-contrast 0.5
|
||||
```
|
||||
|
||||
Available matugen options:
|
||||
- `--matugen-type <type>` - Color scheme type (default: "scheme-tonal-spot")
|
||||
- `--matugen-mode <mode>` - Light or dark mode (default: "dark")
|
||||
- `--matugen-contrast <float>` - Contrast value from -1 to 1 (default: 0.0)
|
||||
|
||||
#### All Options
|
||||
|
||||
```
|
||||
-h, --help Show help message and exit
|
||||
-v, --version Print version information and exit
|
||||
-a, --apply Apply default theme
|
||||
-c, --config Set config file path (default: ~/.config/clrsync/config.toml)
|
||||
-l, --list-themes List available themes
|
||||
-s, --show-vars Show color keys
|
||||
-t, --theme Set theme <theme_name> to apply
|
||||
-p, --path Set theme file <path/to/theme> to apply
|
||||
-g, --generate Generate palette from <image path>
|
||||
--generate-color Generate palette from a color (hex), used with --generator matugen
|
||||
--generator Palette generator to use (default: "hellwal")
|
||||
```
|
||||
|
||||
### GUI
|
||||
|
||||
Launch the graphical editor:
|
||||
@@ -471,6 +532,7 @@ You may find some pre-configured color schemes and templates in [extra](extra) d
|
||||
## Acknowledgments
|
||||
|
||||
- **[matugen](https://github.com/InioX/matugen)** - A material you color generation tool
|
||||
- **[hellwal](https://github.com/danihek/hellwal)** - Pywal-like color palette generator, but faster and in C
|
||||
- **[Dear ImGui](https://github.com/ocornut/imgui)** - Bloat-free graphical user interface library for C++
|
||||
- **[GLFW](https://www.glfw.org/)** - Multi-platform library for OpenGL, OpenGL ES and Vulkan development
|
||||
- **[toml++](https://github.com/marzer/tomlplusplus)** - Header-only TOML config file parser and serializer for C++17
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 856 KiB After Width: | Height: | Size: 240 KiB |
@@ -21,21 +21,72 @@ base0F = '#D2D2D2FF'
|
||||
border = '#242424FF'
|
||||
border_focused = '#2E2E2EFF'
|
||||
cursor = '#D2D2D2FF'
|
||||
# Editor - Basic
|
||||
editor_background = '#111111FF'
|
||||
editor_command = '#3A898CFF'
|
||||
editor_comment = '#849899FF'
|
||||
editor_disabled = '#849899FF'
|
||||
editor_emphasis = '#A9DC86FF'
|
||||
editor_error = '#AA4E4AFF'
|
||||
editor_inactive = '#849899FF'
|
||||
editor_line_number = '#849899FF'
|
||||
editor_link = '#B0779EFF'
|
||||
editor_main = '#D2D2D2FF'
|
||||
editor_selected = '#242424FF'
|
||||
editor_foreground = '#D2D2D2FF'
|
||||
editor_line_highlight = '#191919FF'
|
||||
editor_selection = '#242424FF'
|
||||
editor_selection_inactive = '#1D1C1CFF'
|
||||
editor_cursor = '#D2D2D2FF'
|
||||
editor_whitespace = '#3A3A3AFF'
|
||||
|
||||
# Editor - Gutter
|
||||
editor_gutter_background = '#111111FF'
|
||||
editor_gutter_foreground = '#849899FF'
|
||||
editor_line_number = '#849899FF'
|
||||
editor_line_number_active = '#D2D2D2FF'
|
||||
|
||||
# Editor - Syntax
|
||||
editor_comment = '#849899FF'
|
||||
editor_string = '#9A8652FF'
|
||||
editor_success = '#668A51FF'
|
||||
editor_number = '#B47837FF'
|
||||
editor_boolean = '#B47837FF'
|
||||
editor_keyword = '#3A898CFF'
|
||||
editor_operator = '#D2D2D2FF'
|
||||
editor_function = '#A9DC86FF'
|
||||
editor_variable = '#D2D2D2FF'
|
||||
editor_parameter = '#B0779EFF'
|
||||
editor_property = '#9A8652FF'
|
||||
editor_constant = '#B47837FF'
|
||||
editor_type = '#3A898CFF'
|
||||
editor_class = '#3A898CFF'
|
||||
editor_interface = '#3A898CFF'
|
||||
editor_enum = '#3A898CFF'
|
||||
editor_namespace = '#B0779EFF'
|
||||
editor_attribute = '#A9DC86FF'
|
||||
editor_decorator = '#A9DC86FF'
|
||||
editor_tag = '#AA4E4AFF'
|
||||
editor_punctuation = '#D2D2D2FF'
|
||||
editor_link = '#B0779EFF'
|
||||
editor_regex = '#AA477BFF'
|
||||
editor_escape_character = '#B47837FF'
|
||||
|
||||
# Editor - Diagnostics
|
||||
editor_invalid = '#AA4E4AFF'
|
||||
editor_error = '#AA4E4AFF'
|
||||
editor_error_background = '#3A1A1AFF'
|
||||
editor_warning = '#B47837FF'
|
||||
editor_warning_background = '#3A2A1AFF'
|
||||
editor_info = '#3A898CFF'
|
||||
editor_info_background = '#1A2A3AFF'
|
||||
editor_hint = '#668A51FF'
|
||||
editor_hint_background = '#1A2A1AFF'
|
||||
|
||||
# Editor - UI Elements
|
||||
editor_active_line_border = '#2E2E2EFF'
|
||||
editor_indent_guide = '#2A2A2AFF'
|
||||
editor_indent_guide_active = '#3A3A3AFF'
|
||||
editor_bracket_match = '#3A898CFF'
|
||||
editor_search_match = '#9A865280'
|
||||
editor_search_match_active = '#9A8652FF'
|
||||
editor_find_range_highlight = '#9A865240'
|
||||
|
||||
# Editor - Diff
|
||||
editor_deleted = '#AA4E4AFF'
|
||||
editor_inserted = '#668A51FF'
|
||||
editor_modified = '#9A8652FF'
|
||||
editor_ignored = '#849899FF'
|
||||
editor_folded_background = '#191919FF'
|
||||
error = '#AA4E4AFF'
|
||||
foreground = '#D2D2D2FF'
|
||||
info = '#3A898CFF'
|
||||
|
||||
@@ -21,21 +21,72 @@ base0F = '#2A2A2AFF'
|
||||
border = '#C5C5C5FF'
|
||||
border_focused = '#B9B9B9FF'
|
||||
cursor = '#2A2A2AFF'
|
||||
# Editor - Basic
|
||||
editor_background = '#E0E0E0FF'
|
||||
editor_command = '#3A898CFF'
|
||||
editor_comment = '#849899FF'
|
||||
editor_disabled = '#A0A0A0FF'
|
||||
editor_emphasis = '#4A7A2EFF'
|
||||
editor_error = '#AA4E4AFF'
|
||||
editor_inactive = '#A0A0A0FF'
|
||||
editor_line_number = '#9A9A95FF'
|
||||
editor_link = '#90577EFF'
|
||||
editor_main = '#2A2A2AFF'
|
||||
editor_selected = '#C9C9C9FF'
|
||||
editor_foreground = '#2A2A2AFF'
|
||||
editor_line_highlight = '#D5D5D5FF'
|
||||
editor_selection = '#C9C9C9FF'
|
||||
editor_selection_inactive = '#D2D2D2FF'
|
||||
editor_cursor = '#2A2A2AFF'
|
||||
editor_whitespace = '#B0B0B0FF'
|
||||
|
||||
# Editor - Gutter
|
||||
editor_gutter_background = '#E0E0E0FF'
|
||||
editor_gutter_foreground = '#9A9A95FF'
|
||||
editor_line_number = '#9A9A95FF'
|
||||
editor_line_number_active = '#2A2A2AFF'
|
||||
|
||||
# Editor - Syntax
|
||||
editor_comment = '#849899FF'
|
||||
editor_string = '#9A8652FF'
|
||||
editor_success = '#668A51FF'
|
||||
editor_number = '#B47837FF'
|
||||
editor_boolean = '#B47837FF'
|
||||
editor_keyword = '#3A898CFF'
|
||||
editor_operator = '#2A2A2AFF'
|
||||
editor_function = '#4A7A2EFF'
|
||||
editor_variable = '#2A2A2AFF'
|
||||
editor_parameter = '#90577EFF'
|
||||
editor_property = '#9A8652FF'
|
||||
editor_constant = '#B47837FF'
|
||||
editor_type = '#3A898CFF'
|
||||
editor_class = '#3A898CFF'
|
||||
editor_interface = '#3A898CFF'
|
||||
editor_enum = '#3A898CFF'
|
||||
editor_namespace = '#90577EFF'
|
||||
editor_attribute = '#4A7A2EFF'
|
||||
editor_decorator = '#4A7A2EFF'
|
||||
editor_tag = '#AA4E4AFF'
|
||||
editor_punctuation = '#2A2A2AFF'
|
||||
editor_link = '#90577EFF'
|
||||
editor_regex = '#AA477BFF'
|
||||
editor_escape_character = '#B47837FF'
|
||||
|
||||
# Editor - Diagnostics
|
||||
editor_invalid = '#AA4E4AFF'
|
||||
editor_error = '#AA4E4AFF'
|
||||
editor_error_background = '#FFDDDDFF'
|
||||
editor_warning = '#B47837FF'
|
||||
editor_warning_background = '#FFF0D0FF'
|
||||
editor_info = '#3A898CFF'
|
||||
editor_info_background = '#D0F0FFFF'
|
||||
editor_hint = '#668A51FF'
|
||||
editor_hint_background = '#D0FFD0FF'
|
||||
|
||||
# Editor - UI Elements
|
||||
editor_active_line_border = '#C5C5C5FF'
|
||||
editor_indent_guide = '#CFCFCFFF'
|
||||
editor_indent_guide_active = '#B0B0B0FF'
|
||||
editor_bracket_match = '#3A898CFF'
|
||||
editor_search_match = '#9A865280'
|
||||
editor_search_match_active = '#9A8652FF'
|
||||
editor_find_range_highlight = '#9A865240'
|
||||
|
||||
# Editor - Diff
|
||||
editor_deleted = '#AA4E4AFF'
|
||||
editor_inserted = '#668A51FF'
|
||||
editor_modified = '#9A8652FF'
|
||||
editor_ignored = '#A0A0A0FF'
|
||||
editor_folded_background = '#D5D5D5FF'
|
||||
error = '#AA4E4AFF'
|
||||
foreground = '#2A2A2AFF'
|
||||
info = '#3A898CFF'
|
||||
|
||||
@@ -3,91 +3,370 @@ vim.cmd("syntax reset")
|
||||
vim.g.colors_name = "clrsync"
|
||||
|
||||
local palette = {
|
||||
-- Editor colors
|
||||
Default = "{editor_main.hex}",
|
||||
Keyword = "{editor_command.hex}",
|
||||
Number = "{editor_warning.hex}",
|
||||
String = "{editor_string.hex}",
|
||||
CharLiteral = "{editor_string.hex}",
|
||||
Punctuation = "{editor_main.hex}",
|
||||
Preprocessor = "{editor_emphasis.hex}",
|
||||
Identifier = "{editor_main.hex}",
|
||||
KnownIdentifier = "{editor_link.hex}",
|
||||
PreprocIdentifier = "{editor_link.hex}",
|
||||
-- General UI
|
||||
bg = "{editor_background.hex}",
|
||||
bg_alt = "{surface_variant.hex}",
|
||||
fg = "{editor_foreground.hex}",
|
||||
fg_alt = "{on_surface_variant.hex}",
|
||||
grey = "{editor_line_number.hex}",
|
||||
|
||||
Comment = "{editor_comment.hex}",
|
||||
MultiLineComment = "{editor_comment.hex}",
|
||||
-- Accent / keyword colors
|
||||
blue = "{editor_keyword.hex}",
|
||||
cyan = "{editor_info.hex}",
|
||||
violet = "{editor_link.hex}",
|
||||
magenta = "{editor_parameter.hex}",
|
||||
orange = "{editor_number.hex}",
|
||||
yellow = "{editor_warning.hex}",
|
||||
green = "{success.hex}",
|
||||
red = "{error.hex}",
|
||||
|
||||
Background = "{editor_background.hex}",
|
||||
Cursor = "{cursor.hex}",
|
||||
-- Editor - Basic
|
||||
cursor = "{cursor.hex}",
|
||||
selection = "{editor_selection.hex}",
|
||||
dark_blue = "{editor_selection.hex}",
|
||||
line_highlight = "{editor_line_highlight.hex}",
|
||||
|
||||
Selection = "{editor_selected.hex}",
|
||||
ErrorMarker = "{editor_error.hex}",
|
||||
Breakpoint = "{editor_error.hex}",
|
||||
-- Editor - Gutter
|
||||
line_number = "{editor_line_number.hex}",
|
||||
line_number_active = "{editor_line_number_active.hex}",
|
||||
|
||||
LineNumber = "{editor_line_number.hex}",
|
||||
CurrentLineFill = "{surface_variant.hex}",
|
||||
CurrentLineFillInactive = "{surface.hex}",
|
||||
-- Editor - Syntax
|
||||
comment = "{editor_comment.hex}",
|
||||
string = "{editor_string.hex}",
|
||||
number = "{editor_number.hex}",
|
||||
boolean = "{editor_boolean.hex}",
|
||||
keyword = "{editor_keyword.hex}",
|
||||
operator = "{editor_operator.hex}",
|
||||
function_ = "{editor_function.hex}",
|
||||
variable = "{editor_variable.hex}",
|
||||
parameter = "{editor_parameter.hex}",
|
||||
property = "{editor_property.hex}",
|
||||
constant = "{editor_constant.hex}",
|
||||
type_ = "{editor_type.hex}",
|
||||
tag = "{editor_tag.hex}",
|
||||
punctuation = "{editor_punctuation.hex}",
|
||||
link = "{editor_link.hex}",
|
||||
regex = "{editor_regex.hex}",
|
||||
attribute = "{editor_attribute.hex}",
|
||||
decorator = "{editor_decorator.hex}",
|
||||
escape_char = "{editor_escape_character.hex}",
|
||||
|
||||
CurrentLineEdge = "{border_focused.hex}",
|
||||
|
||||
-- Semantic colors
|
||||
Success = "{success.hex}",
|
||||
Warning = "{warning.hex}",
|
||||
Error = "{error.hex}",
|
||||
Info = "{info.hex}",
|
||||
-- Editor - UI
|
||||
border = "{border_focused.hex}",
|
||||
indent_guide = "{editor_indent_guide.hex}",
|
||||
search_match = "{editor_search_match.hex}",
|
||||
search_match_active = "{editor_search_match_active.hex}",
|
||||
bracket_match = "{editor_bracket_match.hex}",
|
||||
whitespace = "{editor_whitespace.hex}",
|
||||
|
||||
-- Editor - Diagnostics
|
||||
error_fg = "{editor_error.hex}",
|
||||
warning_fg = "{editor_warning.hex}",
|
||||
info_fg = "{editor_info.hex}",
|
||||
hint_fg = "{editor_hint.hex}",
|
||||
|
||||
-- Editor - Diff
|
||||
diff_add = "{editor_inserted.hex}",
|
||||
diff_change = "{editor_modified.hex}",
|
||||
diff_delete = "{editor_deleted.hex}",
|
||||
|
||||
-- Semantic
|
||||
success = "{success.hex}",
|
||||
warning = "{warning.hex}",
|
||||
error = "{error.hex}",
|
||||
info = "{info.hex}",
|
||||
|
||||
-- Base (terminal / muted)
|
||||
base0 = "{background.hex}",
|
||||
base1 = "{surface.hex}",
|
||||
base2 = "{surface_variant.hex}",
|
||||
base3 = "{border.hex}",
|
||||
base4 = "{editor_line_number.hex}",
|
||||
base5 = "{editor_comment.hex}",
|
||||
base6 = "{editor_line_number.hex}",
|
||||
base7 = "{on_surface_variant.hex}",
|
||||
base8 = "{foreground.hex}",
|
||||
}
|
||||
|
||||
-- Helper function to set highlights in Neovim
|
||||
local function set_hl(group, opts)
|
||||
vim.api.nvim_set_hl(0, group, opts)
|
||||
end
|
||||
|
||||
vim.o.winborder = "rounded"
|
||||
|
||||
-- Basic editor highlights using the mapped palette
|
||||
set_hl("Normal", { fg = palette.Default, bg = palette.Background })
|
||||
set_hl("CursorLine", { bg = palette.CurrentLineFill })
|
||||
set_hl("Visual", { bg = palette.Selection })
|
||||
set_hl("LineNr", { fg = palette.LineNumber })
|
||||
set_hl("CursorLineNr", { fg = palette.Keyword })
|
||||
--- General UI
|
||||
set_hl("Normal", { bg = palette.bg, fg = palette.fg })
|
||||
set_hl("NormalFloat", { bg = palette.bg, fg = palette.fg })
|
||||
set_hl("NormalBorder", { bg = palette.bg, fg = palette.fg })
|
||||
set_hl("EndOfBuffer", { bg = palette.bg, fg = palette.bg })
|
||||
|
||||
-- Syntax highlights
|
||||
set_hl("Comment", { fg = palette.Comment, italic = true })
|
||||
set_hl("Constant", { fg = palette.Number })
|
||||
set_hl("String", { fg = palette.String })
|
||||
set_hl("Character", { fg = palette.CharLiteral })
|
||||
set_hl("Identifier", { fg = palette.Identifier })
|
||||
set_hl("Function", { fg = palette.Keyword })
|
||||
set_hl("Statement", { fg = palette.Keyword })
|
||||
set_hl("PreProc", { fg = palette.Preprocessor })
|
||||
set_hl("Type", { fg = palette.Keyword })
|
||||
set_hl("Special", { fg = palette.PreprocIdentifier })
|
||||
set_hl("Underlined", { fg = palette.KnownIdentifier })
|
||||
set_hl("Error", { fg = palette.ErrorMarker, bg = palette.Background })
|
||||
set_hl("Todo", { fg = palette.Default, bg = palette.Keyword })
|
||||
set_hl("Visual", { bg = palette.dark_blue })
|
||||
set_hl("VisualBold", { bg = palette.dark_blue, bold = true })
|
||||
|
||||
-- Floating windows
|
||||
set_hl("NormalFloat", { bg = palette.Background })
|
||||
set_hl("FloatBorder", { fg = palette.CurrentLineEdge, bg = palette.Background })
|
||||
set_hl("LineNr", { bg = palette.bg, fg = palette.grey })
|
||||
set_hl("Cursor", { bg = palette.blue })
|
||||
set_hl("CursorLine", { bg = palette.bg_alt })
|
||||
set_hl("CursorLineNr", { bg = palette.bg_alt, fg = palette.fg })
|
||||
set_hl("CursorColumn", { bg = palette.bg_alt })
|
||||
|
||||
-- Completion menu
|
||||
set_hl("Pmenu", { bg = palette.Background })
|
||||
set_hl("PmenuSel", { bg = palette.Keyword, fg = palette.Background })
|
||||
set_hl("Folded", { bg = palette.bg_alt, fg = palette.base5 })
|
||||
set_hl("FoldColumn", { bg = palette.bg, fg = palette.fg_alt })
|
||||
set_hl("SignColumn", { bg = palette.bg })
|
||||
set_hl("ColorColumn", { bg = palette.bg_alt })
|
||||
|
||||
-- Git and diagnostic highlights
|
||||
set_hl("DiffAdd", { fg = palette.Success, bg = palette.Background })
|
||||
set_hl("DiffChange", { fg = palette.Keyword, bg = palette.Background })
|
||||
set_hl("DiffDelete", { fg = palette.ErrorMarker, bg = palette.Background })
|
||||
set_hl("DiagnosticError", { fg = palette.Error })
|
||||
set_hl("DiagnosticWarn", { fg = palette.Warning })
|
||||
set_hl("DiagnosticInfo", { fg = palette.Info })
|
||||
set_hl("DiagnosticHint", { fg = palette.PreprocIdentifier })
|
||||
set_hl("IndentGuide", { fg = palette.indent_guide })
|
||||
set_hl("IndentGuideEven", { link = "IndentGuide" })
|
||||
set_hl("IndentGuideOdd", { link = "IndentGuide" })
|
||||
|
||||
-- Treesitter links
|
||||
set_hl("TermCursor", { fg = palette.fg, reverse = true })
|
||||
set_hl("TermCursorNC", { fg = palette.fg_alt, reverse = true })
|
||||
set_hl("TermNormal", { link = "Normal" })
|
||||
set_hl("TermNormalNC", { link = "TermNormal" })
|
||||
|
||||
set_hl("WildMenu", { bg = palette.dark_blue, fg = palette.fg })
|
||||
set_hl("Separator", { fg = palette.fg_alt })
|
||||
set_hl("VertSplit", { bg = palette.bg, fg = palette.grey })
|
||||
|
||||
set_hl("TabLine", { bg = palette.bg_alt, fg = palette.base7, bold = true })
|
||||
set_hl("TabLineSel", { bg = palette.bg, fg = palette.blue, bold = true })
|
||||
set_hl("TabLineFill", { bg = palette.base1, bold = true })
|
||||
|
||||
set_hl("StatusLine", { bg = palette.base3, fg = palette.base8 })
|
||||
set_hl("StatusLineNC", { bg = palette.bg_alt, fg = palette.base6 })
|
||||
set_hl("StatusLinePart", { bg = palette.bg_alt, fg = palette.base6, bold = true })
|
||||
set_hl("StatusLinePartNC", { link = "StatusLinePart" })
|
||||
|
||||
set_hl("Pmenu", { bg = palette.bg_alt, fg = palette.fg })
|
||||
set_hl("PmenuSel", { bg = palette.blue, fg = palette.base0 })
|
||||
set_hl("PmenuSelBold", { bg = palette.blue, fg = palette.base0, bold = true })
|
||||
set_hl("PmenuSbar", { bg = palette.bg_alt })
|
||||
set_hl("PmenuThumb", { bg = palette.grey })
|
||||
|
||||
set_hl("FloatBorder", { fg = palette.border, bg = palette.bg })
|
||||
|
||||
--- Search, Highlight, Conceal
|
||||
set_hl("Search", { bg = palette.dark_blue, fg = palette.fg })
|
||||
set_hl("Substitute", { fg = palette.red, bold = true, strikethrough = true })
|
||||
set_hl("IncSearch", { bg = palette.yellow, fg = palette.bg, bold = true })
|
||||
set_hl("IncSearchCursor", { reverse = true })
|
||||
|
||||
set_hl("Conceal", { fg = palette.grey })
|
||||
set_hl("SpecialKey", { fg = palette.violet, bold = true })
|
||||
set_hl("NonText", { fg = palette.fg_alt, bold = true })
|
||||
set_hl("MatchParen", { fg = palette.red, bold = true })
|
||||
set_hl("Whitespace", { fg = palette.whitespace })
|
||||
|
||||
set_hl("Highlight", { bg = palette.bg_alt })
|
||||
set_hl("HighlightSubtle", { link = "Highlight" })
|
||||
|
||||
set_hl("Question", { fg = palette.green, bold = true })
|
||||
|
||||
set_hl("File", { fg = palette.fg })
|
||||
set_hl("Directory", { fg = palette.violet, bold = true })
|
||||
set_hl("Title", { fg = palette.violet, bold = true })
|
||||
|
||||
set_hl("Bold", { bold = true })
|
||||
set_hl("Emphasis", { italic = true })
|
||||
|
||||
--- Messages
|
||||
set_hl("Msg", { fg = palette.green })
|
||||
set_hl("MoreMsg", { fg = palette.blue })
|
||||
set_hl("WarningMsg", { fg = palette.yellow })
|
||||
set_hl("Error", { fg = palette.red })
|
||||
set_hl("ErrorMsg", { fg = palette.red })
|
||||
set_hl("ModeMsg", { fg = palette.violet })
|
||||
set_hl("Todo", { fg = palette.yellow, bold = true })
|
||||
|
||||
set_hl("healthError", { link = "ErrorMsg" })
|
||||
set_hl("healthSuccess", { link = "Msg" })
|
||||
set_hl("healthWarning", { link = "WarningMsg" })
|
||||
|
||||
--- Syntax
|
||||
set_hl("Tag", { fg = palette.cyan, bold = true })
|
||||
set_hl("Link", { fg = palette.green, underline = true })
|
||||
set_hl("URL", { link = "Link" })
|
||||
set_hl("Underlined", { fg = palette.cyan, underline = true })
|
||||
|
||||
set_hl("Comment", { fg = palette.comment, italic = true })
|
||||
set_hl("CommentBold", { fg = palette.comment, bold = true })
|
||||
set_hl("SpecialComment", { fg = palette.base7, bold = true })
|
||||
|
||||
set_hl("Macro", { fg = palette.violet })
|
||||
set_hl("Define", { fg = palette.violet, bold = true })
|
||||
set_hl("Include", { fg = palette.violet, bold = true })
|
||||
set_hl("PreProc", { fg = palette.violet, bold = true })
|
||||
set_hl("PreCondit", { fg = palette.violet, bold = true })
|
||||
|
||||
set_hl("Label", { fg = palette.blue })
|
||||
set_hl("Repeat", { fg = palette.blue })
|
||||
set_hl("Keyword", { fg = palette.blue })
|
||||
set_hl("Operator", { fg = palette.operator })
|
||||
set_hl("Delimiter", { fg = palette.blue })
|
||||
set_hl("Statement", { fg = palette.blue })
|
||||
set_hl("Exception", { fg = palette.blue })
|
||||
set_hl("Conditional", { fg = palette.blue })
|
||||
|
||||
set_hl("Variable", { fg = palette.variable })
|
||||
set_hl("VariableBuiltin", { fg = palette.magenta, bold = true })
|
||||
set_hl("Constant", { fg = palette.violet, bold = true })
|
||||
|
||||
set_hl("Number", { fg = palette.orange })
|
||||
set_hl("Float", { link = "Number" })
|
||||
set_hl("Boolean", { fg = palette.orange, bold = true })
|
||||
set_hl("Enum", { fg = palette.orange })
|
||||
|
||||
set_hl("Character", { fg = palette.violet, bold = true })
|
||||
set_hl("SpecialChar", { fg = palette.violet, bold = true })
|
||||
set_hl("String", { fg = palette.green })
|
||||
set_hl("StringDelimiter", { link = "String" })
|
||||
|
||||
set_hl("Special", { fg = palette.violet })
|
||||
set_hl("SpecialBold", { fg = palette.violet, bold = true })
|
||||
|
||||
set_hl("Field", { fg = palette.violet })
|
||||
set_hl("Argument", { fg = palette.parameter })
|
||||
set_hl("Attribute", { fg = palette.attribute })
|
||||
set_hl("Identifier", { fg = palette.variable })
|
||||
set_hl("Property", { fg = palette.property })
|
||||
set_hl("Function", { fg = palette.function_ })
|
||||
set_hl("FunctionBuiltin", { fg = palette.function_, bold = true })
|
||||
set_hl("KeywordFunction", { fg = palette.blue, bold = true })
|
||||
set_hl("Method", { fg = palette.function_ })
|
||||
|
||||
set_hl("Type", { fg = palette.type_ })
|
||||
set_hl("Typedef", { fg = palette.blue })
|
||||
set_hl("TypeBuiltin", { fg = palette.type_, bold = true })
|
||||
set_hl("Class", { fg = palette.blue })
|
||||
set_hl("StorageClass", { fg = palette.blue })
|
||||
set_hl("Structure", { fg = palette.blue })
|
||||
|
||||
set_hl("Regexp", { fg = palette.regex })
|
||||
set_hl("RegexpSpecial", { fg = palette.regex })
|
||||
set_hl("RegexpDelimiter", { fg = palette.regex, bold = true })
|
||||
set_hl("RegexpKey", { fg = palette.regex, bold = true })
|
||||
|
||||
set_hl("CommentURL", { link = "URL" })
|
||||
set_hl("CommentLabel", { link = "CommentBold" })
|
||||
set_hl("CommentSection", { link = "CommentBold" })
|
||||
set_hl("Noise", { link = "Comment" })
|
||||
|
||||
--- Diff
|
||||
set_hl("DiffAddedGutter", { fg = palette.green, bold = true })
|
||||
set_hl("DiffModifiedGutter", { fg = palette.orange, bold = true })
|
||||
set_hl("DiffRemovedGutter", { fg = palette.red, bold = true })
|
||||
|
||||
set_hl("DiffAdd", { link = "DiffAddedGutter" })
|
||||
set_hl("DiffChange", { link = "DiffModifiedGutter" })
|
||||
set_hl("DiffDelete", { link = "DiffRemovedGutter" })
|
||||
|
||||
set_hl("diffAdded", { fg = palette.green, bg = palette.bg_alt })
|
||||
set_hl("diffChanged", { fg = palette.violet })
|
||||
set_hl("diffRemoved", { fg = palette.red, bg = palette.base3 })
|
||||
set_hl("diffLine", { fg = palette.violet })
|
||||
set_hl("diffIndexLine", { fg = palette.cyan })
|
||||
set_hl("diffSubname", { fg = palette.cyan })
|
||||
set_hl("diffFile", { fg = palette.cyan })
|
||||
set_hl("diffOldFile", { fg = palette.blue })
|
||||
set_hl("diffNewFile", { fg = palette.blue })
|
||||
|
||||
--- Markdown
|
||||
set_hl("markdownCode", { link = "Comment" })
|
||||
set_hl("markdownCodeBlock", { link = "markdownCode" })
|
||||
set_hl("markdownH1", { bold = true })
|
||||
set_hl("markdownH2", { bold = true })
|
||||
set_hl("markdownLinkText", { underline = true })
|
||||
|
||||
--- LSP / Diagnostics
|
||||
set_hl("LspHighlight", { bg = palette.bg_alt, bold = true })
|
||||
set_hl("LspSignatureActiveParameter", { fg = palette.violet })
|
||||
|
||||
set_hl("DiagnosticError", { fg = palette.error })
|
||||
set_hl("DiagnosticWarn", { fg = palette.warning })
|
||||
set_hl("DiagnosticInfo", { fg = palette.info })
|
||||
set_hl("DiagnosticHint", { fg = palette.hint_fg })
|
||||
set_hl("DiagnosticFloatingError", { link = "ErrorMsg" })
|
||||
set_hl("DiagnosticFloatingWarn", { link = "WarningMsg" })
|
||||
set_hl("DiagnosticFloatingInfo", { link = "MoreMsg" })
|
||||
set_hl("DiagnosticFloatingHint", { link = "Msg" })
|
||||
set_hl("DiagnosticDefaultError", { link = "ErrorMsg" })
|
||||
set_hl("DiagnosticDefaultWarn", { link = "WarningMsg" })
|
||||
set_hl("DiagnosticDefaultInfo", { link = "MoreMsg" })
|
||||
set_hl("DiagnosticDefaultHint", { link = "Msg" })
|
||||
set_hl("DiagnosticVirtualTextError", { link = "ErrorMsg" })
|
||||
set_hl("DiagnosticVirtualTextWarn", { link = "WarningMsg" })
|
||||
set_hl("DiagnosticVirtualTextInfo", { link = "MoreMsg" })
|
||||
set_hl("DiagnosticVirtualTextHint", { link = "Msg" })
|
||||
set_hl("DiagnosticSignError", { link = "ErrorMsg" })
|
||||
set_hl("DiagnosticSignWarning", { link = "WarningMsg" })
|
||||
set_hl("DiagnosticSignInformation", { link = "MoreMsg" })
|
||||
set_hl("DiagnosticSignHint", { link = "Msg" })
|
||||
|
||||
set_hl("LspReferenceText", { link = "LspHighlight" })
|
||||
set_hl("LspReferenceRead", { link = "LspHighlight" })
|
||||
set_hl("LspReferenceWrite", { link = "LspHighlight" })
|
||||
|
||||
--- Tree-Sitter
|
||||
set_hl("@annotation", { link = "PreProc" })
|
||||
set_hl("@attribute", { link = "Attribute" })
|
||||
set_hl("@conditional", { link = "Conditional" })
|
||||
set_hl("@comment", { link = "Comment" })
|
||||
set_hl("@string", { fg = palette.String })
|
||||
set_hl("@function", { fg = palette.Keyword })
|
||||
set_hl("@variable", { fg = palette.Identifier })
|
||||
set_hl("@keyword", { fg = palette.Keyword })
|
||||
set_hl("@type", { fg = palette.Preprocessor })
|
||||
set_hl("@constructor", { link = "Structure" })
|
||||
set_hl("@constant", { link = "Constant" })
|
||||
set_hl("@constant.builtin", { link = "Constant" })
|
||||
set_hl("@constant.macro", { link = "Macro" })
|
||||
set_hl("@error", { link = "Error" })
|
||||
set_hl("@exception", { link = "Exception" })
|
||||
set_hl("@field", { link = "Field" })
|
||||
set_hl("@float", { link = "Float" })
|
||||
set_hl("@function", { link = "Function" })
|
||||
set_hl("@function.builtin", { link = "FunctionBuiltin" })
|
||||
set_hl("@function.macro", { link = "Macro" })
|
||||
set_hl("@include", { link = "Include" })
|
||||
set_hl("@keyword", { link = "Keyword" })
|
||||
set_hl("@keyword.function", { link = "KeywordFunction" })
|
||||
set_hl("@label", { link = "Label" })
|
||||
set_hl("@math", { link = "Special" })
|
||||
set_hl("@method", { link = "Method" })
|
||||
set_hl("@namespace", { link = "Directory" })
|
||||
set_hl("@number", { link = "Number" })
|
||||
set_hl("@boolean", { link = "Boolean" })
|
||||
set_hl("@operator", { link = "Operator" })
|
||||
set_hl("@parameter", { link = "Argument" })
|
||||
set_hl("@parameter.reference", { link = "Argument" })
|
||||
set_hl("@property", { link = "Property" })
|
||||
set_hl("@punctuation.delimiter", { link = "Delimiter" })
|
||||
set_hl("@punctuation.bracket", { link = "Delimiter" })
|
||||
set_hl("@punctuation.special", { link = "Delimiter" })
|
||||
set_hl("@repeat", { link = "Repeat" })
|
||||
set_hl("@string", { link = "String" })
|
||||
set_hl("@string.regex", { link = "StringDelimiter" })
|
||||
set_hl("@string.escape", { link = "StringDelimiter" })
|
||||
set_hl("@structure", { link = "Structure" })
|
||||
set_hl("@tag", { link = "Tag" })
|
||||
set_hl("@tag.attribute", { link = "Attribute" })
|
||||
set_hl("@tag.delimiter", { link = "Delimiter" })
|
||||
set_hl("@strong", { link = "Bold" })
|
||||
set_hl("@uri", { link = "URL" })
|
||||
set_hl("@warning", { link = "WarningMsg" })
|
||||
set_hl("@danger", { link = "ErrorMsg" })
|
||||
set_hl("@type", { link = "Type" })
|
||||
set_hl("@type.builtin", { link = "TypeBuiltin" })
|
||||
set_hl("@variable", { fg = palette.variable })
|
||||
set_hl("@variable.builtin", { link = "VariableBuiltin" })
|
||||
set_hl("@text", { link = "Normal" })
|
||||
set_hl("@text.strong", { fg = palette.fg, bold = true })
|
||||
set_hl("@text.emphasis", { link = "Emphasis" })
|
||||
set_hl("@text.underline", { underline = true })
|
||||
set_hl("@text.title", { link = "Title" })
|
||||
set_hl("@text.uri", { link = "URL" })
|
||||
set_hl("@text.note", { link = "MoreMsg" })
|
||||
set_hl("@text.warning", { link = "WarningMsg" })
|
||||
set_hl("@text.danger", { link = "ErrorMsg" })
|
||||
set_hl("@todo", { link = "Todo" })
|
||||
|
||||
--- NetRW
|
||||
set_hl("netrwClassify", { fg = palette.blue })
|
||||
set_hl("netrwDir", { link = "Directory" })
|
||||
set_hl("netrwExe", { fg = palette.green, bold = true })
|
||||
set_hl("netrwMakefile", { fg = palette.yellow, bold = true })
|
||||
set_hl("netrwTreeBar", { link = "Comment" })
|
||||
|
||||
@@ -21,21 +21,72 @@ base0F = '#B0AFA8FF'
|
||||
border = '#3F3639FF'
|
||||
border_focused = '#E1C135FF'
|
||||
cursor = '#E1C135FF'
|
||||
# Editor - Basic
|
||||
editor_background = '#151515FF'
|
||||
editor_command = '#CEB34FFF'
|
||||
editor_comment = '#7A7A7AFF'
|
||||
editor_disabled = '#3F3639FF'
|
||||
editor_emphasis = '#DC7671FF'
|
||||
editor_error = '#B44242FF'
|
||||
editor_inactive = '#3F3639FF'
|
||||
editor_line_number = '#86596CFF'
|
||||
editor_link = '#60928FFF'
|
||||
editor_main = '#C2C2B0FF'
|
||||
editor_selected = '#3F3639FF'
|
||||
editor_foreground = '#C2C2B0FF'
|
||||
editor_line_highlight = '#1C1C1CFF'
|
||||
editor_selection = '#3F3639FF'
|
||||
editor_selection_inactive = '#2A2A2AFF'
|
||||
editor_cursor = '#E1C135FF'
|
||||
editor_whitespace = '#3F3639FF'
|
||||
|
||||
# Editor - Gutter
|
||||
editor_gutter_background = '#151515FF'
|
||||
editor_gutter_foreground = '#7A7A7AFF'
|
||||
editor_line_number = '#86596CFF'
|
||||
editor_line_number_active = '#C2C2B0FF'
|
||||
|
||||
# Editor - Syntax
|
||||
editor_comment = '#7A7A7AFF'
|
||||
editor_string = '#76C39BFF'
|
||||
editor_success = '#95A328FF'
|
||||
editor_number = '#DC7671FF'
|
||||
editor_boolean = '#DC7671FF'
|
||||
editor_keyword = '#CEB34FFF'
|
||||
editor_operator = '#C2C2B0FF'
|
||||
editor_function = '#95A328FF'
|
||||
editor_variable = '#C2C2B0FF'
|
||||
editor_parameter = '#60928FFF'
|
||||
editor_property = '#76C39BFF'
|
||||
editor_constant = '#DC7671FF'
|
||||
editor_type = '#60928FFF'
|
||||
editor_class = '#60928FFF'
|
||||
editor_interface = '#60928FFF'
|
||||
editor_enum = '#60928FFF'
|
||||
editor_namespace = '#86596CFF'
|
||||
editor_attribute = '#E1C135FF'
|
||||
editor_decorator = '#E1C135FF'
|
||||
editor_tag = '#B44242FF'
|
||||
editor_punctuation = '#B0AFA8FF'
|
||||
editor_link = '#60928FFF'
|
||||
editor_regex = '#CEB34FFF'
|
||||
editor_escape_character = '#DC7671FF'
|
||||
|
||||
# Editor - Diagnostics
|
||||
editor_invalid = '#B44242FF'
|
||||
editor_error = '#B44242FF'
|
||||
editor_error_background = '#2A1515FF'
|
||||
editor_warning = '#E1C135FF'
|
||||
editor_warning_background = '#2A2515FF'
|
||||
editor_info = '#60928FFF'
|
||||
editor_info_background = '#15252AFF'
|
||||
editor_hint = '#95A328FF'
|
||||
editor_hint_background = '#1A2A15FF'
|
||||
|
||||
# Editor - UI Elements
|
||||
editor_active_line_border = '#3F3639FF'
|
||||
editor_indent_guide = '#2A2A2AFF'
|
||||
editor_indent_guide_active = '#3F3639FF'
|
||||
editor_bracket_match = '#E1C135FF'
|
||||
editor_search_match = '#E1C13580'
|
||||
editor_search_match_active = '#E1C135FF'
|
||||
editor_find_range_highlight = '#E1C13540'
|
||||
|
||||
# Editor - Diff
|
||||
editor_deleted = '#B44242FF'
|
||||
editor_inserted = '#95A328FF'
|
||||
editor_modified = '#E1C135FF'
|
||||
editor_ignored = '#7A7A7AFF'
|
||||
editor_folded_background = '#1C1C1CFF'
|
||||
error = '#B44242FF'
|
||||
foreground = '#C2C2B0FF'
|
||||
info = '#60928FFF'
|
||||
|
||||
@@ -21,21 +21,72 @@ base0F = '#ECEFF4FF'
|
||||
border = '#4C566AFF'
|
||||
border_focused = '#88C0D0FF'
|
||||
cursor = '#D8DEE9FF'
|
||||
# Editor - Basic
|
||||
editor_background = '#2E3440FF'
|
||||
editor_command = '#81A1C1FF'
|
||||
editor_comment = '#616E88FF'
|
||||
editor_disabled = '#4C566AFF'
|
||||
editor_emphasis = '#B48EADFF'
|
||||
editor_error = '#BF616AFF'
|
||||
editor_inactive = '#616E88FF'
|
||||
editor_line_number = '#4C566AFF'
|
||||
editor_link = '#88C0D0FF'
|
||||
editor_main = '#D8DEE9FF'
|
||||
editor_selected = '#434C5EFF'
|
||||
editor_foreground = '#D8DEE9FF'
|
||||
editor_line_highlight = '#3B4252FF'
|
||||
editor_selection = '#434C5EFF'
|
||||
editor_selection_inactive = '#3B4252FF'
|
||||
editor_cursor = '#D8DEE9FF'
|
||||
editor_whitespace = '#4C566AFF'
|
||||
|
||||
# Editor - Gutter
|
||||
editor_gutter_background = '#2E3440FF'
|
||||
editor_gutter_foreground = '#4C566AFF'
|
||||
editor_line_number = '#4C566AFF'
|
||||
editor_line_number_active = '#D8DEE9FF'
|
||||
|
||||
# Editor - Syntax
|
||||
editor_comment = '#616E88FF'
|
||||
editor_string = '#A3BE8CFF'
|
||||
editor_success = '#A3BE8CFF'
|
||||
editor_number = '#B48EADFF'
|
||||
editor_boolean = '#B48EADFF'
|
||||
editor_keyword = '#81A1C1FF'
|
||||
editor_operator = '#D8DEE9FF'
|
||||
editor_function = '#88C0D0FF'
|
||||
editor_variable = '#D8DEE9FF'
|
||||
editor_parameter = '#D8DEE9FF'
|
||||
editor_property = '#8FBCBBFF'
|
||||
editor_constant = '#B48EADFF'
|
||||
editor_type = '#8FBCBBFF'
|
||||
editor_class = '#8FBCBBFF'
|
||||
editor_interface = '#8FBCBBFF'
|
||||
editor_enum = '#8FBCBBFF'
|
||||
editor_namespace = '#5E81ACFF'
|
||||
editor_attribute = '#D08770FF'
|
||||
editor_decorator = '#D08770FF'
|
||||
editor_tag = '#BF616AFF'
|
||||
editor_punctuation = '#ECEFF4FF'
|
||||
editor_link = '#88C0D0FF'
|
||||
editor_regex = '#EBCB8BFF'
|
||||
editor_escape_character = '#D08770FF'
|
||||
|
||||
# Editor - Diagnostics
|
||||
editor_invalid = '#BF616AFF'
|
||||
editor_error = '#BF616AFF'
|
||||
editor_error_background = '#3B2E2EFF'
|
||||
editor_warning = '#EBCB8BFF'
|
||||
editor_warning_background = '#3B3B2EFF'
|
||||
editor_info = '#5E81ACFF'
|
||||
editor_info_background = '#2E3440FF'
|
||||
editor_hint = '#A3BE8CFF'
|
||||
editor_hint_background = '#2E3B2EFF'
|
||||
|
||||
# Editor - UI Elements
|
||||
editor_active_line_border = '#4C566AFF'
|
||||
editor_indent_guide = '#3B4252FF'
|
||||
editor_indent_guide_active = '#4C566AFF'
|
||||
editor_bracket_match = '#88C0D0FF'
|
||||
editor_search_match = '#EBCB8B80'
|
||||
editor_search_match_active = '#EBCB8BFF'
|
||||
editor_find_range_highlight = '#EBCB8B40'
|
||||
|
||||
# Editor - Diff
|
||||
editor_deleted = '#BF616AFF'
|
||||
editor_inserted = '#A3BE8CFF'
|
||||
editor_modified = '#EBCB8BFF'
|
||||
editor_ignored = '#616E88FF'
|
||||
editor_folded_background = '#3B4252FF'
|
||||
error = '#BF616AFF'
|
||||
foreground = '#D8DEE9FF'
|
||||
info = '#5E81ACFF'
|
||||
|
||||
@@ -21,21 +21,72 @@ base0F = '#4F4F48FF'
|
||||
border = '#D0D0C8FF'
|
||||
border_focused = '#C9A305FF'
|
||||
cursor = '#C9A305FF'
|
||||
# Editor - Basic
|
||||
editor_background = '#F5F5F5FF'
|
||||
editor_command = '#B89A1FFF'
|
||||
editor_comment = '#A0A098FF'
|
||||
editor_disabled = '#C0C0B8FF'
|
||||
editor_emphasis = '#DC7671FF'
|
||||
editor_error = '#B44242FF'
|
||||
editor_inactive = '#A0A098FF'
|
||||
editor_line_number = '#86596CFF'
|
||||
editor_link = '#60928FFF'
|
||||
editor_main = '#3D3D2FFF'
|
||||
editor_selected = '#D0D0C8FF'
|
||||
editor_foreground = '#3D3D2FFF'
|
||||
editor_line_highlight = '#E8E8E8FF'
|
||||
editor_selection = '#D0D0C8FF'
|
||||
editor_selection_inactive = '#E0E0D8FF'
|
||||
editor_cursor = '#C9A305FF'
|
||||
editor_whitespace = '#C0C0B8FF'
|
||||
|
||||
# Editor - Gutter
|
||||
editor_gutter_background = '#F5F5F5FF'
|
||||
editor_gutter_foreground = '#A0A098FF'
|
||||
editor_line_number = '#86596CFF'
|
||||
editor_line_number_active = '#3D3D2FFF'
|
||||
|
||||
# Editor - Syntax
|
||||
editor_comment = '#A0A098FF'
|
||||
editor_string = '#5FA37BFF'
|
||||
editor_success = '#95A328FF'
|
||||
editor_number = '#DC7671FF'
|
||||
editor_boolean = '#DC7671FF'
|
||||
editor_keyword = '#B89A1FFF'
|
||||
editor_operator = '#3D3D2FFF'
|
||||
editor_function = '#95A328FF'
|
||||
editor_variable = '#3D3D2FFF'
|
||||
editor_parameter = '#60928FFF'
|
||||
editor_property = '#5FA37BFF'
|
||||
editor_constant = '#DC7671FF'
|
||||
editor_type = '#60928FFF'
|
||||
editor_class = '#60928FFF'
|
||||
editor_interface = '#60928FFF'
|
||||
editor_enum = '#60928FFF'
|
||||
editor_namespace = '#86596CFF'
|
||||
editor_attribute = '#C9A305FF'
|
||||
editor_decorator = '#C9A305FF'
|
||||
editor_tag = '#B44242FF'
|
||||
editor_punctuation = '#4F4F48FF'
|
||||
editor_link = '#60928FFF'
|
||||
editor_regex = '#B89A1FFF'
|
||||
editor_escape_character = '#DC7671FF'
|
||||
|
||||
# Editor - Diagnostics
|
||||
editor_invalid = '#B44242FF'
|
||||
editor_error = '#B44242FF'
|
||||
editor_error_background = '#FFEDEDFF'
|
||||
editor_warning = '#C9A305FF'
|
||||
editor_warning_background = '#FFF8E0FF'
|
||||
editor_info = '#60928FFF'
|
||||
editor_info_background = '#E0F8FFFF'
|
||||
editor_hint = '#95A328FF'
|
||||
editor_hint_background = '#E8FFE8FF'
|
||||
|
||||
# Editor - UI Elements
|
||||
editor_active_line_border = '#D0D0C8FF'
|
||||
editor_indent_guide = '#E0E0D8FF'
|
||||
editor_indent_guide_active = '#C0C0B8FF'
|
||||
editor_bracket_match = '#C9A305FF'
|
||||
editor_search_match = '#C9A30580'
|
||||
editor_search_match_active = '#C9A305FF'
|
||||
editor_find_range_highlight = '#C9A30540'
|
||||
|
||||
# Editor - Diff
|
||||
editor_deleted = '#B44242FF'
|
||||
editor_inserted = '#95A328FF'
|
||||
editor_modified = '#C9A305FF'
|
||||
editor_ignored = '#A0A098FF'
|
||||
editor_folded_background = '#E8E8E8FF'
|
||||
error = '#B44242FF'
|
||||
foreground = '#3D3D2FFF'
|
||||
info = '#60928FFF'
|
||||
|
||||
@@ -3,91 +3,370 @@ vim.cmd("syntax reset")
|
||||
vim.g.colors_name = "clrsync"
|
||||
|
||||
local palette = {
|
||||
-- Editor colors
|
||||
Default = "{editor_main.hex}",
|
||||
Keyword = "{editor_command.hex}",
|
||||
Number = "{editor_warning.hex}",
|
||||
String = "{editor_string.hex}",
|
||||
CharLiteral = "{editor_string.hex}",
|
||||
Punctuation = "{editor_main.hex}",
|
||||
Preprocessor = "{editor_emphasis.hex}",
|
||||
Identifier = "{editor_main.hex}",
|
||||
KnownIdentifier = "{editor_link.hex}",
|
||||
PreprocIdentifier = "{editor_link.hex}",
|
||||
-- General UI
|
||||
bg = "{editor_background.hex}",
|
||||
bg_alt = "{surface_variant.hex}",
|
||||
fg = "{editor_foreground.hex}",
|
||||
fg_alt = "{on_surface_variant.hex}",
|
||||
grey = "{editor_line_number.hex}",
|
||||
|
||||
Comment = "{editor_comment.hex}",
|
||||
MultiLineComment = "{editor_comment.hex}",
|
||||
-- Accent / keyword colors
|
||||
blue = "{editor_keyword.hex}",
|
||||
cyan = "{editor_info.hex}",
|
||||
violet = "{editor_link.hex}",
|
||||
magenta = "{editor_parameter.hex}",
|
||||
orange = "{editor_number.hex}",
|
||||
yellow = "{editor_warning.hex}",
|
||||
green = "{success.hex}",
|
||||
red = "{error.hex}",
|
||||
|
||||
Background = "{editor_background.hex}",
|
||||
Cursor = "{cursor.hex}",
|
||||
-- Editor - Basic
|
||||
cursor = "{cursor.hex}",
|
||||
selection = "{editor_selection.hex}",
|
||||
dark_blue = "{editor_selection.hex}",
|
||||
line_highlight = "{editor_line_highlight.hex}",
|
||||
|
||||
Selection = "{editor_selected.hex}",
|
||||
ErrorMarker = "{editor_error.hex}",
|
||||
Breakpoint = "{editor_error.hex}",
|
||||
-- Editor - Gutter
|
||||
line_number = "{editor_line_number.hex}",
|
||||
line_number_active = "{editor_line_number_active.hex}",
|
||||
|
||||
LineNumber = "{editor_line_number.hex}",
|
||||
CurrentLineFill = "{surface_variant.hex}",
|
||||
CurrentLineFillInactive = "{surface.hex}",
|
||||
-- Editor - Syntax
|
||||
comment = "{editor_comment.hex}",
|
||||
string = "{editor_string.hex}",
|
||||
number = "{editor_number.hex}",
|
||||
boolean = "{editor_boolean.hex}",
|
||||
keyword = "{editor_keyword.hex}",
|
||||
operator = "{editor_operator.hex}",
|
||||
function_ = "{editor_function.hex}",
|
||||
variable = "{editor_variable.hex}",
|
||||
parameter = "{editor_parameter.hex}",
|
||||
property = "{editor_property.hex}",
|
||||
constant = "{editor_constant.hex}",
|
||||
type_ = "{editor_type.hex}",
|
||||
tag = "{editor_tag.hex}",
|
||||
punctuation = "{editor_punctuation.hex}",
|
||||
link = "{editor_link.hex}",
|
||||
regex = "{editor_regex.hex}",
|
||||
attribute = "{editor_attribute.hex}",
|
||||
decorator = "{editor_decorator.hex}",
|
||||
escape_char = "{editor_escape_character.hex}",
|
||||
|
||||
CurrentLineEdge = "{border_focused.hex}",
|
||||
|
||||
-- Semantic colors
|
||||
Success = "{success.hex}",
|
||||
Warning = "{warning.hex}",
|
||||
Error = "{error.hex}",
|
||||
Info = "{info.hex}",
|
||||
-- Editor - UI
|
||||
border = "{border_focused.hex}",
|
||||
indent_guide = "{editor_indent_guide.hex}",
|
||||
search_match = "{editor_search_match.hex}",
|
||||
search_match_active = "{editor_search_match_active.hex}",
|
||||
bracket_match = "{editor_bracket_match.hex}",
|
||||
whitespace = "{editor_whitespace.hex}",
|
||||
|
||||
-- Editor - Diagnostics
|
||||
error_fg = "{editor_error.hex}",
|
||||
warning_fg = "{editor_warning.hex}",
|
||||
info_fg = "{editor_info.hex}",
|
||||
hint_fg = "{editor_hint.hex}",
|
||||
|
||||
-- Editor - Diff
|
||||
diff_add = "{editor_inserted.hex}",
|
||||
diff_change = "{editor_modified.hex}",
|
||||
diff_delete = "{editor_deleted.hex}",
|
||||
|
||||
-- Semantic
|
||||
success = "{success.hex}",
|
||||
warning = "{warning.hex}",
|
||||
error = "{error.hex}",
|
||||
info = "{info.hex}",
|
||||
|
||||
-- Base (terminal / muted)
|
||||
base0 = "{background.hex}",
|
||||
base1 = "{surface.hex}",
|
||||
base2 = "{surface_variant.hex}",
|
||||
base3 = "{border.hex}",
|
||||
base4 = "{editor_line_number.hex}",
|
||||
base5 = "{editor_comment.hex}",
|
||||
base6 = "{editor_line_number.hex}",
|
||||
base7 = "{on_surface_variant.hex}",
|
||||
base8 = "{foreground.hex}",
|
||||
}
|
||||
|
||||
-- Helper function to set highlights in Neovim
|
||||
local function set_hl(group, opts)
|
||||
vim.api.nvim_set_hl(0, group, opts)
|
||||
end
|
||||
|
||||
vim.o.winborder = "rounded"
|
||||
|
||||
-- Basic editor highlights using the mapped palette
|
||||
set_hl("Normal", { fg = palette.Default, bg = palette.Background })
|
||||
set_hl("CursorLine", { bg = palette.CurrentLineFill })
|
||||
set_hl("Visual", { bg = palette.Selection })
|
||||
set_hl("LineNr", { fg = palette.LineNumber })
|
||||
set_hl("CursorLineNr", { fg = palette.Keyword })
|
||||
--- General UI
|
||||
set_hl("Normal", { bg = palette.bg, fg = palette.fg })
|
||||
set_hl("NormalFloat", { bg = palette.bg, fg = palette.fg })
|
||||
set_hl("NormalBorder", { bg = palette.bg, fg = palette.fg })
|
||||
set_hl("EndOfBuffer", { bg = palette.bg, fg = palette.bg })
|
||||
|
||||
-- Syntax highlights
|
||||
set_hl("Comment", { fg = palette.Comment, italic = true })
|
||||
set_hl("Constant", { fg = palette.Number })
|
||||
set_hl("String", { fg = palette.String })
|
||||
set_hl("Character", { fg = palette.CharLiteral })
|
||||
set_hl("Identifier", { fg = palette.Identifier })
|
||||
set_hl("Function", { fg = palette.Keyword })
|
||||
set_hl("Statement", { fg = palette.Keyword })
|
||||
set_hl("PreProc", { fg = palette.Preprocessor })
|
||||
set_hl("Type", { fg = palette.Keyword })
|
||||
set_hl("Special", { fg = palette.PreprocIdentifier })
|
||||
set_hl("Underlined", { fg = palette.KnownIdentifier })
|
||||
set_hl("Error", { fg = palette.ErrorMarker, bg = palette.Background })
|
||||
set_hl("Todo", { fg = palette.Default, bg = palette.Keyword })
|
||||
set_hl("Visual", { bg = palette.dark_blue })
|
||||
set_hl("VisualBold", { bg = palette.dark_blue, bold = true })
|
||||
|
||||
-- Floating windows
|
||||
set_hl("NormalFloat", { bg = palette.Background })
|
||||
set_hl("FloatBorder", { fg = palette.CurrentLineEdge, bg = palette.Background })
|
||||
set_hl("LineNr", { bg = palette.bg, fg = palette.grey })
|
||||
set_hl("Cursor", { bg = palette.blue })
|
||||
set_hl("CursorLine", { bg = palette.bg_alt })
|
||||
set_hl("CursorLineNr", { bg = palette.bg_alt, fg = palette.fg })
|
||||
set_hl("CursorColumn", { bg = palette.bg_alt })
|
||||
|
||||
-- Completion menu
|
||||
set_hl("Pmenu", { bg = palette.Background })
|
||||
set_hl("PmenuSel", { bg = palette.Keyword, fg = palette.Background })
|
||||
set_hl("Folded", { bg = palette.bg_alt, fg = palette.base5 })
|
||||
set_hl("FoldColumn", { bg = palette.bg, fg = palette.fg_alt })
|
||||
set_hl("SignColumn", { bg = palette.bg })
|
||||
set_hl("ColorColumn", { bg = palette.bg_alt })
|
||||
|
||||
-- Git and diagnostic highlights
|
||||
set_hl("DiffAdd", { fg = palette.Success, bg = palette.Background })
|
||||
set_hl("DiffChange", { fg = palette.Keyword, bg = palette.Background })
|
||||
set_hl("DiffDelete", { fg = palette.ErrorMarker, bg = palette.Background })
|
||||
set_hl("DiagnosticError", { fg = palette.Error })
|
||||
set_hl("DiagnosticWarn", { fg = palette.Warning })
|
||||
set_hl("DiagnosticInfo", { fg = palette.Info })
|
||||
set_hl("DiagnosticHint", { fg = palette.PreprocIdentifier })
|
||||
set_hl("IndentGuide", { fg = palette.indent_guide })
|
||||
set_hl("IndentGuideEven", { link = "IndentGuide" })
|
||||
set_hl("IndentGuideOdd", { link = "IndentGuide" })
|
||||
|
||||
-- Treesitter links
|
||||
set_hl("TermCursor", { fg = palette.fg, reverse = true })
|
||||
set_hl("TermCursorNC", { fg = palette.fg_alt, reverse = true })
|
||||
set_hl("TermNormal", { link = "Normal" })
|
||||
set_hl("TermNormalNC", { link = "TermNormal" })
|
||||
|
||||
set_hl("WildMenu", { bg = palette.dark_blue, fg = palette.fg })
|
||||
set_hl("Separator", { fg = palette.fg_alt })
|
||||
set_hl("VertSplit", { bg = palette.bg, fg = palette.grey })
|
||||
|
||||
set_hl("TabLine", { bg = palette.bg_alt, fg = palette.base7, bold = true })
|
||||
set_hl("TabLineSel", { bg = palette.bg, fg = palette.blue, bold = true })
|
||||
set_hl("TabLineFill", { bg = palette.base1, bold = true })
|
||||
|
||||
set_hl("StatusLine", { bg = palette.base3, fg = palette.base8 })
|
||||
set_hl("StatusLineNC", { bg = palette.bg_alt, fg = palette.base6 })
|
||||
set_hl("StatusLinePart", { bg = palette.bg_alt, fg = palette.base6, bold = true })
|
||||
set_hl("StatusLinePartNC", { link = "StatusLinePart" })
|
||||
|
||||
set_hl("Pmenu", { bg = palette.bg_alt, fg = palette.fg })
|
||||
set_hl("PmenuSel", { bg = palette.blue, fg = palette.base0 })
|
||||
set_hl("PmenuSelBold", { bg = palette.blue, fg = palette.base0, bold = true })
|
||||
set_hl("PmenuSbar", { bg = palette.bg_alt })
|
||||
set_hl("PmenuThumb", { bg = palette.grey })
|
||||
|
||||
set_hl("FloatBorder", { fg = palette.border, bg = palette.bg })
|
||||
|
||||
--- Search, Highlight, Conceal
|
||||
set_hl("Search", { bg = palette.dark_blue, fg = palette.fg })
|
||||
set_hl("Substitute", { fg = palette.red, bold = true, strikethrough = true })
|
||||
set_hl("IncSearch", { bg = palette.yellow, fg = palette.bg, bold = true })
|
||||
set_hl("IncSearchCursor", { reverse = true })
|
||||
|
||||
set_hl("Conceal", { fg = palette.grey })
|
||||
set_hl("SpecialKey", { fg = palette.violet, bold = true })
|
||||
set_hl("NonText", { fg = palette.fg_alt, bold = true })
|
||||
set_hl("MatchParen", { fg = palette.red, bold = true })
|
||||
set_hl("Whitespace", { fg = palette.whitespace })
|
||||
|
||||
set_hl("Highlight", { bg = palette.bg_alt })
|
||||
set_hl("HighlightSubtle", { link = "Highlight" })
|
||||
|
||||
set_hl("Question", { fg = palette.green, bold = true })
|
||||
|
||||
set_hl("File", { fg = palette.fg })
|
||||
set_hl("Directory", { fg = palette.violet, bold = true })
|
||||
set_hl("Title", { fg = palette.violet, bold = true })
|
||||
|
||||
set_hl("Bold", { bold = true })
|
||||
set_hl("Emphasis", { italic = true })
|
||||
|
||||
--- Messages
|
||||
set_hl("Msg", { fg = palette.green })
|
||||
set_hl("MoreMsg", { fg = palette.blue })
|
||||
set_hl("WarningMsg", { fg = palette.yellow })
|
||||
set_hl("Error", { fg = palette.red })
|
||||
set_hl("ErrorMsg", { fg = palette.red })
|
||||
set_hl("ModeMsg", { fg = palette.violet })
|
||||
set_hl("Todo", { fg = palette.yellow, bold = true })
|
||||
|
||||
set_hl("healthError", { link = "ErrorMsg" })
|
||||
set_hl("healthSuccess", { link = "Msg" })
|
||||
set_hl("healthWarning", { link = "WarningMsg" })
|
||||
|
||||
--- Syntax
|
||||
set_hl("Tag", { fg = palette.cyan, bold = true })
|
||||
set_hl("Link", { fg = palette.green, underline = true })
|
||||
set_hl("URL", { link = "Link" })
|
||||
set_hl("Underlined", { fg = palette.cyan, underline = true })
|
||||
|
||||
set_hl("Comment", { fg = palette.comment, italic = true })
|
||||
set_hl("CommentBold", { fg = palette.comment, bold = true })
|
||||
set_hl("SpecialComment", { fg = palette.base7, bold = true })
|
||||
|
||||
set_hl("Macro", { fg = palette.violet })
|
||||
set_hl("Define", { fg = palette.violet, bold = true })
|
||||
set_hl("Include", { fg = palette.violet, bold = true })
|
||||
set_hl("PreProc", { fg = palette.violet, bold = true })
|
||||
set_hl("PreCondit", { fg = palette.violet, bold = true })
|
||||
|
||||
set_hl("Label", { fg = palette.blue })
|
||||
set_hl("Repeat", { fg = palette.blue })
|
||||
set_hl("Keyword", { fg = palette.blue })
|
||||
set_hl("Operator", { fg = palette.operator })
|
||||
set_hl("Delimiter", { fg = palette.blue })
|
||||
set_hl("Statement", { fg = palette.blue })
|
||||
set_hl("Exception", { fg = palette.blue })
|
||||
set_hl("Conditional", { fg = palette.blue })
|
||||
|
||||
set_hl("Variable", { fg = palette.variable })
|
||||
set_hl("VariableBuiltin", { fg = palette.magenta, bold = true })
|
||||
set_hl("Constant", { fg = palette.violet, bold = true })
|
||||
|
||||
set_hl("Number", { fg = palette.orange })
|
||||
set_hl("Float", { link = "Number" })
|
||||
set_hl("Boolean", { fg = palette.orange, bold = true })
|
||||
set_hl("Enum", { fg = palette.orange })
|
||||
|
||||
set_hl("Character", { fg = palette.violet, bold = true })
|
||||
set_hl("SpecialChar", { fg = palette.violet, bold = true })
|
||||
set_hl("String", { fg = palette.green })
|
||||
set_hl("StringDelimiter", { link = "String" })
|
||||
|
||||
set_hl("Special", { fg = palette.violet })
|
||||
set_hl("SpecialBold", { fg = palette.violet, bold = true })
|
||||
|
||||
set_hl("Field", { fg = palette.violet })
|
||||
set_hl("Argument", { fg = palette.parameter })
|
||||
set_hl("Attribute", { fg = palette.attribute })
|
||||
set_hl("Identifier", { fg = palette.variable })
|
||||
set_hl("Property", { fg = palette.property })
|
||||
set_hl("Function", { fg = palette.function_ })
|
||||
set_hl("FunctionBuiltin", { fg = palette.function_, bold = true })
|
||||
set_hl("KeywordFunction", { fg = palette.blue, bold = true })
|
||||
set_hl("Method", { fg = palette.function_ })
|
||||
|
||||
set_hl("Type", { fg = palette.type_ })
|
||||
set_hl("Typedef", { fg = palette.blue })
|
||||
set_hl("TypeBuiltin", { fg = palette.type_, bold = true })
|
||||
set_hl("Class", { fg = palette.blue })
|
||||
set_hl("StorageClass", { fg = palette.blue })
|
||||
set_hl("Structure", { fg = palette.blue })
|
||||
|
||||
set_hl("Regexp", { fg = palette.regex })
|
||||
set_hl("RegexpSpecial", { fg = palette.regex })
|
||||
set_hl("RegexpDelimiter", { fg = palette.regex, bold = true })
|
||||
set_hl("RegexpKey", { fg = palette.regex, bold = true })
|
||||
|
||||
set_hl("CommentURL", { link = "URL" })
|
||||
set_hl("CommentLabel", { link = "CommentBold" })
|
||||
set_hl("CommentSection", { link = "CommentBold" })
|
||||
set_hl("Noise", { link = "Comment" })
|
||||
|
||||
--- Diff
|
||||
set_hl("DiffAddedGutter", { fg = palette.green, bold = true })
|
||||
set_hl("DiffModifiedGutter", { fg = palette.orange, bold = true })
|
||||
set_hl("DiffRemovedGutter", { fg = palette.red, bold = true })
|
||||
|
||||
set_hl("DiffAdd", { link = "DiffAddedGutter" })
|
||||
set_hl("DiffChange", { link = "DiffModifiedGutter" })
|
||||
set_hl("DiffDelete", { link = "DiffRemovedGutter" })
|
||||
|
||||
set_hl("diffAdded", { fg = palette.green, bg = palette.bg_alt })
|
||||
set_hl("diffChanged", { fg = palette.violet })
|
||||
set_hl("diffRemoved", { fg = palette.red, bg = palette.base3 })
|
||||
set_hl("diffLine", { fg = palette.violet })
|
||||
set_hl("diffIndexLine", { fg = palette.cyan })
|
||||
set_hl("diffSubname", { fg = palette.cyan })
|
||||
set_hl("diffFile", { fg = palette.cyan })
|
||||
set_hl("diffOldFile", { fg = palette.blue })
|
||||
set_hl("diffNewFile", { fg = palette.blue })
|
||||
|
||||
--- Markdown
|
||||
set_hl("markdownCode", { link = "Comment" })
|
||||
set_hl("markdownCodeBlock", { link = "markdownCode" })
|
||||
set_hl("markdownH1", { bold = true })
|
||||
set_hl("markdownH2", { bold = true })
|
||||
set_hl("markdownLinkText", { underline = true })
|
||||
|
||||
--- LSP / Diagnostics
|
||||
set_hl("LspHighlight", { bg = palette.bg_alt, bold = true })
|
||||
set_hl("LspSignatureActiveParameter", { fg = palette.violet })
|
||||
|
||||
set_hl("DiagnosticError", { fg = palette.error })
|
||||
set_hl("DiagnosticWarn", { fg = palette.warning })
|
||||
set_hl("DiagnosticInfo", { fg = palette.info })
|
||||
set_hl("DiagnosticHint", { fg = palette.hint_fg })
|
||||
set_hl("DiagnosticFloatingError", { link = "ErrorMsg" })
|
||||
set_hl("DiagnosticFloatingWarn", { link = "WarningMsg" })
|
||||
set_hl("DiagnosticFloatingInfo", { link = "MoreMsg" })
|
||||
set_hl("DiagnosticFloatingHint", { link = "Msg" })
|
||||
set_hl("DiagnosticDefaultError", { link = "ErrorMsg" })
|
||||
set_hl("DiagnosticDefaultWarn", { link = "WarningMsg" })
|
||||
set_hl("DiagnosticDefaultInfo", { link = "MoreMsg" })
|
||||
set_hl("DiagnosticDefaultHint", { link = "Msg" })
|
||||
set_hl("DiagnosticVirtualTextError", { link = "ErrorMsg" })
|
||||
set_hl("DiagnosticVirtualTextWarn", { link = "WarningMsg" })
|
||||
set_hl("DiagnosticVirtualTextInfo", { link = "MoreMsg" })
|
||||
set_hl("DiagnosticVirtualTextHint", { link = "Msg" })
|
||||
set_hl("DiagnosticSignError", { link = "ErrorMsg" })
|
||||
set_hl("DiagnosticSignWarning", { link = "WarningMsg" })
|
||||
set_hl("DiagnosticSignInformation", { link = "MoreMsg" })
|
||||
set_hl("DiagnosticSignHint", { link = "Msg" })
|
||||
|
||||
set_hl("LspReferenceText", { link = "LspHighlight" })
|
||||
set_hl("LspReferenceRead", { link = "LspHighlight" })
|
||||
set_hl("LspReferenceWrite", { link = "LspHighlight" })
|
||||
|
||||
--- Tree-Sitter
|
||||
set_hl("@annotation", { link = "PreProc" })
|
||||
set_hl("@attribute", { link = "Attribute" })
|
||||
set_hl("@conditional", { link = "Conditional" })
|
||||
set_hl("@comment", { link = "Comment" })
|
||||
set_hl("@string", { fg = palette.String })
|
||||
set_hl("@function", { fg = palette.Keyword })
|
||||
set_hl("@variable", { fg = palette.Identifier })
|
||||
set_hl("@keyword", { fg = palette.Keyword })
|
||||
set_hl("@type", { fg = palette.Preprocessor })
|
||||
set_hl("@constructor", { link = "Structure" })
|
||||
set_hl("@constant", { link = "Constant" })
|
||||
set_hl("@constant.builtin", { link = "Constant" })
|
||||
set_hl("@constant.macro", { link = "Macro" })
|
||||
set_hl("@error", { link = "Error" })
|
||||
set_hl("@exception", { link = "Exception" })
|
||||
set_hl("@field", { link = "Field" })
|
||||
set_hl("@float", { link = "Float" })
|
||||
set_hl("@function", { link = "Function" })
|
||||
set_hl("@function.builtin", { link = "FunctionBuiltin" })
|
||||
set_hl("@function.macro", { link = "Macro" })
|
||||
set_hl("@include", { link = "Include" })
|
||||
set_hl("@keyword", { link = "Keyword" })
|
||||
set_hl("@keyword.function", { link = "KeywordFunction" })
|
||||
set_hl("@label", { link = "Label" })
|
||||
set_hl("@math", { link = "Special" })
|
||||
set_hl("@method", { link = "Method" })
|
||||
set_hl("@namespace", { link = "Directory" })
|
||||
set_hl("@number", { link = "Number" })
|
||||
set_hl("@boolean", { link = "Boolean" })
|
||||
set_hl("@operator", { link = "Operator" })
|
||||
set_hl("@parameter", { link = "Argument" })
|
||||
set_hl("@parameter.reference", { link = "Argument" })
|
||||
set_hl("@property", { link = "Property" })
|
||||
set_hl("@punctuation.delimiter", { link = "Delimiter" })
|
||||
set_hl("@punctuation.bracket", { link = "Delimiter" })
|
||||
set_hl("@punctuation.special", { link = "Delimiter" })
|
||||
set_hl("@repeat", { link = "Repeat" })
|
||||
set_hl("@string", { link = "String" })
|
||||
set_hl("@string.regex", { link = "StringDelimiter" })
|
||||
set_hl("@string.escape", { link = "StringDelimiter" })
|
||||
set_hl("@structure", { link = "Structure" })
|
||||
set_hl("@tag", { link = "Tag" })
|
||||
set_hl("@tag.attribute", { link = "Attribute" })
|
||||
set_hl("@tag.delimiter", { link = "Delimiter" })
|
||||
set_hl("@strong", { link = "Bold" })
|
||||
set_hl("@uri", { link = "URL" })
|
||||
set_hl("@warning", { link = "WarningMsg" })
|
||||
set_hl("@danger", { link = "ErrorMsg" })
|
||||
set_hl("@type", { link = "Type" })
|
||||
set_hl("@type.builtin", { link = "TypeBuiltin" })
|
||||
set_hl("@variable", { fg = palette.variable })
|
||||
set_hl("@variable.builtin", { link = "VariableBuiltin" })
|
||||
set_hl("@text", { link = "Normal" })
|
||||
set_hl("@text.strong", { fg = palette.fg, bold = true })
|
||||
set_hl("@text.emphasis", { link = "Emphasis" })
|
||||
set_hl("@text.underline", { underline = true })
|
||||
set_hl("@text.title", { link = "Title" })
|
||||
set_hl("@text.uri", { link = "URL" })
|
||||
set_hl("@text.note", { link = "MoreMsg" })
|
||||
set_hl("@text.warning", { link = "WarningMsg" })
|
||||
set_hl("@text.danger", { link = "ErrorMsg" })
|
||||
set_hl("@todo", { link = "Todo" })
|
||||
|
||||
--- NetRW
|
||||
set_hl("netrwClassify", { fg = palette.blue })
|
||||
set_hl("netrwDir", { link = "Directory" })
|
||||
set_hl("netrwExe", { fg = palette.green, bold = true })
|
||||
set_hl("netrwMakefile", { fg = palette.yellow, bold = true })
|
||||
set_hl("netrwTreeBar", { link = "Comment" })
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
|
||||
return handle_apply_theme(program, default_theme);
|
||||
}
|
||||
|
||||
if (program.is_used("--generate"))
|
||||
if (program.is_used("--generate") || program.is_used("--generate-color"))
|
||||
{
|
||||
std::string image_path;
|
||||
if (program.is_used("--generate"))
|
||||
@@ -190,6 +190,12 @@ int main(int argc, char *argv[])
|
||||
clrsync::core::palette pal;
|
||||
if (generator_name == "hellwal")
|
||||
{
|
||||
if (program.is_used("--generate-color"))
|
||||
{
|
||||
std::cerr << "Error: --generate-color is only supported with --generator matugen" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
clrsync::core::hellwal_generator gen;
|
||||
clrsync::core::hellwal_generator::options opts{};
|
||||
|
||||
@@ -289,8 +295,16 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (pal.name().empty())
|
||||
{
|
||||
std::filesystem::path p(image_path);
|
||||
pal.set_name("generated:" + p.filename().string());
|
||||
if (program.is_used("--generate-color"))
|
||||
{
|
||||
std::string color = program.get<std::string>("--generate-color");
|
||||
pal.set_name("generated:" + color);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::filesystem::path p(image_path);
|
||||
pal.set_name("generated:" + p.filename().string());
|
||||
}
|
||||
}
|
||||
|
||||
auto dir = clrsync::core::config::instance().palettes_path();
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace clrsync::core
|
||||
{
|
||||
|
||||
const std::string GIT_SEMVER = "1.0.5+git.g2d015c6";
|
||||
const std::string GIT_SEMVER = "1.1.2+git.g25fbc78";
|
||||
|
||||
const std::string version_string();
|
||||
} // namespace clrsync::core
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "core/io/toml_file.hpp"
|
||||
|
||||
#include "core/palette/color.hpp"
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
@@ -68,6 +69,9 @@ Result<void> config::initialize(std::unique_ptr<clrsync::core::io::file> file)
|
||||
|
||||
std::filesystem::path config::get_user_config_dir()
|
||||
{
|
||||
const char *xdg_config_home = std::getenv("XDG_CONFIG_HOME");
|
||||
if (xdg_config_home && xdg_config_home[0] != '\0')
|
||||
return normalize_path(xdg_config_home) / "clrsync";
|
||||
std::filesystem::path home = normalize_path("~");
|
||||
return home / ".config" / "clrsync";
|
||||
}
|
||||
|
||||
@@ -39,22 +39,72 @@ constexpr const char *COLOR_KEYS[] = {
|
||||
"on_warning",
|
||||
"on_error",
|
||||
|
||||
// Editor
|
||||
// Editor - Basic
|
||||
"editor_background",
|
||||
"editor_command",
|
||||
"editor_comment",
|
||||
"editor_disabled",
|
||||
"editor_emphasis",
|
||||
"editor_error",
|
||||
"editor_inactive",
|
||||
"editor_line_number",
|
||||
"editor_link",
|
||||
"editor_main",
|
||||
"editor_selected",
|
||||
"editor_foreground",
|
||||
"editor_line_highlight",
|
||||
"editor_selection",
|
||||
"editor_selection_inactive",
|
||||
"editor_cursor",
|
||||
"editor_whitespace",
|
||||
|
||||
// Editor - Gutter
|
||||
"editor_gutter_background",
|
||||
"editor_gutter_foreground",
|
||||
"editor_line_number",
|
||||
"editor_line_number_active",
|
||||
|
||||
// Editor - Syntax
|
||||
"editor_comment",
|
||||
"editor_string",
|
||||
"editor_success",
|
||||
"editor_number",
|
||||
"editor_boolean",
|
||||
"editor_keyword",
|
||||
"editor_operator",
|
||||
"editor_function",
|
||||
"editor_variable",
|
||||
"editor_parameter",
|
||||
"editor_property",
|
||||
"editor_constant",
|
||||
"editor_type",
|
||||
"editor_class",
|
||||
"editor_interface",
|
||||
"editor_enum",
|
||||
"editor_namespace",
|
||||
"editor_attribute",
|
||||
"editor_decorator",
|
||||
"editor_tag",
|
||||
"editor_punctuation",
|
||||
"editor_link",
|
||||
"editor_regex",
|
||||
"editor_escape_character",
|
||||
|
||||
// Editor - Diagnostics
|
||||
"editor_invalid",
|
||||
"editor_error",
|
||||
"editor_error_background",
|
||||
"editor_warning",
|
||||
"editor_warning_background",
|
||||
"editor_info",
|
||||
"editor_info_background",
|
||||
"editor_hint",
|
||||
"editor_hint_background",
|
||||
|
||||
// Editor - UI Elements
|
||||
"editor_active_line_border",
|
||||
"editor_indent_guide",
|
||||
"editor_indent_guide_active",
|
||||
"editor_bracket_match",
|
||||
"editor_search_match",
|
||||
"editor_search_match_active",
|
||||
"editor_find_range_highlight",
|
||||
|
||||
// Editor - Diff
|
||||
"editor_deleted",
|
||||
"editor_inserted",
|
||||
"editor_modified",
|
||||
"editor_ignored",
|
||||
"editor_folded_background",
|
||||
|
||||
// Terminal
|
||||
"base00",
|
||||
@@ -106,21 +156,72 @@ inline const std::unordered_map<std::string, uint32_t> DEFAULT_COLORS = {
|
||||
{"on_warning", 0xd2d2d2ff},
|
||||
{"on_error", 0xd2d2d2ff},
|
||||
|
||||
// Editor - Basic
|
||||
{"editor_background", 0x111111ff},
|
||||
{"editor_command", 0x3a898cff},
|
||||
{"editor_comment", 0x849899ff},
|
||||
{"editor_disabled", 0x849899ff},
|
||||
{"editor_emphasis", 0xa9dc86ff},
|
||||
{"editor_error", 0xaa4e4aff},
|
||||
{"editor_inactive", 0x849899ff},
|
||||
{"editor_line_number", 0x849899ff},
|
||||
{"editor_link", 0xb0779eff},
|
||||
{"editor_main", 0xd2d2d2ff},
|
||||
{"editor_selected", 0x242424ff},
|
||||
{"editor_foreground", 0xd2d2d2ff},
|
||||
{"editor_line_highlight", 0x191919ff},
|
||||
{"editor_selection", 0x242424ff},
|
||||
{"editor_selection_inactive", 0x1d1c1cff},
|
||||
{"editor_cursor", 0xd2d2d2ff},
|
||||
{"editor_whitespace", 0x3a3a3aff},
|
||||
|
||||
// Editor - Gutter
|
||||
{"editor_gutter_background", 0x111111ff},
|
||||
{"editor_gutter_foreground", 0x849899ff},
|
||||
{"editor_line_number", 0x849899ff},
|
||||
{"editor_line_number_active", 0xd2d2d2ff},
|
||||
|
||||
// Editor - Syntax
|
||||
{"editor_comment", 0x849899ff},
|
||||
{"editor_string", 0x9a8652ff},
|
||||
{"editor_success", 0x668a51ff},
|
||||
{"editor_number", 0xb47837ff},
|
||||
{"editor_boolean", 0xb47837ff},
|
||||
{"editor_keyword", 0x3a898cff},
|
||||
{"editor_operator", 0xd2d2d2ff},
|
||||
{"editor_function", 0xa9dc86ff},
|
||||
{"editor_variable", 0xd2d2d2ff},
|
||||
{"editor_parameter", 0xb0779eff},
|
||||
{"editor_property", 0x9a8652ff},
|
||||
{"editor_constant", 0xb47837ff},
|
||||
{"editor_type", 0x3a898cff},
|
||||
{"editor_class", 0x3a898cff},
|
||||
{"editor_interface", 0x3a898cff},
|
||||
{"editor_enum", 0x3a898cff},
|
||||
{"editor_namespace", 0xb0779eff},
|
||||
{"editor_attribute", 0xa9dc86ff},
|
||||
{"editor_decorator", 0xa9dc86ff},
|
||||
{"editor_tag", 0xaa4e4aff},
|
||||
{"editor_punctuation", 0xd2d2d2ff},
|
||||
{"editor_link", 0xb0779eff},
|
||||
{"editor_regex", 0xaa477bff},
|
||||
{"editor_escape_character", 0xb47837ff},
|
||||
|
||||
// Editor - Diagnostics
|
||||
{"editor_invalid", 0xaa4e4aff},
|
||||
{"editor_error", 0xaa4e4aff},
|
||||
{"editor_error_background", 0x3a1a1aff},
|
||||
{"editor_warning", 0xb47837ff},
|
||||
{"editor_warning_background", 0x3a2a1aff},
|
||||
{"editor_info", 0x3a898cff},
|
||||
{"editor_info_background", 0x1a2a3aff},
|
||||
{"editor_hint", 0x668a51ff},
|
||||
{"editor_hint_background", 0x1a2a1aff},
|
||||
|
||||
// Editor - UI Elements
|
||||
{"editor_active_line_border", 0x2e2e2eff},
|
||||
{"editor_indent_guide", 0x2a2a2aff},
|
||||
{"editor_indent_guide_active", 0x3a3a3aff},
|
||||
{"editor_bracket_match", 0x3a898cff},
|
||||
{"editor_search_match", 0x9a865280},
|
||||
{"editor_search_match_active", 0x9a8652ff},
|
||||
{"editor_find_range_highlight", 0x9a865240},
|
||||
|
||||
// Editor - Diff
|
||||
{"editor_deleted", 0xaa4e4aff},
|
||||
{"editor_inserted", 0x668a51ff},
|
||||
{"editor_modified", 0x9a8652ff},
|
||||
{"editor_ignored", 0x849899ff},
|
||||
{"editor_folded_background", 0x191919ff},
|
||||
|
||||
{"base00", 0x111111ff},
|
||||
{"base01", 0x668a51ff},
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
#include <regex>
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
#endif
|
||||
|
||||
namespace clrsync::core
|
||||
{
|
||||
static std::string run_command_capture_output(const std::string &cmd)
|
||||
@@ -154,21 +159,72 @@ palette hellwal_generator::generate_from_image(const std::string &image_path, co
|
||||
pal.set_color("on_surface_variant", get_color_by_index(7));
|
||||
pal.set_color("on_background", get_color_by_index(7));
|
||||
|
||||
// Editor - Basic
|
||||
pal.set_color("editor_background", get_color_by_index(0));
|
||||
pal.set_color("editor_main", get_color_by_index(7));
|
||||
pal.set_color("editor_comment", get_color_by_index(8));
|
||||
pal.set_color("editor_disabled", get_color_by_index(8));
|
||||
pal.set_color("editor_inactive", get_color_by_index(8));
|
||||
pal.set_color("editor_string", get_color_by_index(2));
|
||||
pal.set_color("editor_command", get_color_by_index(5));
|
||||
pal.set_color("editor_emphasis", get_color_by_index(11));
|
||||
pal.set_color("editor_link", get_color_by_index(4));
|
||||
pal.set_color("editor_line_number", get_color_by_index(8));
|
||||
pal.set_color("editor_selected", get_color_by_index(8));
|
||||
pal.set_color("editor_foreground", get_color_by_index(7));
|
||||
pal.set_color("editor_line_highlight", get_color_by_index(8));
|
||||
pal.set_color("editor_selection", get_color_by_index(8));
|
||||
pal.set_color("editor_selection_inactive", get_color_by_index(8));
|
||||
pal.set_color("editor_cursor", get_color_by_index(7));
|
||||
pal.set_color("editor_whitespace", get_color_by_index(8));
|
||||
|
||||
// Editor - Gutter
|
||||
pal.set_color("editor_gutter_background", get_color_by_index(0));
|
||||
pal.set_color("editor_gutter_foreground", get_color_by_index(8));
|
||||
pal.set_color("editor_line_number", get_color_by_index(8));
|
||||
pal.set_color("editor_line_number_active", get_color_by_index(7));
|
||||
|
||||
// Editor - Syntax
|
||||
pal.set_color("editor_comment", get_color_by_index(8));
|
||||
pal.set_color("editor_string", get_color_by_index(2));
|
||||
pal.set_color("editor_number", get_color_by_index(3));
|
||||
pal.set_color("editor_boolean", get_color_by_index(3));
|
||||
pal.set_color("editor_keyword", get_color_by_index(5));
|
||||
pal.set_color("editor_operator", get_color_by_index(7));
|
||||
pal.set_color("editor_function", get_color_by_index(11));
|
||||
pal.set_color("editor_variable", get_color_by_index(7));
|
||||
pal.set_color("editor_parameter", get_color_by_index(4));
|
||||
pal.set_color("editor_property", get_color_by_index(2));
|
||||
pal.set_color("editor_constant", get_color_by_index(3));
|
||||
pal.set_color("editor_type", get_color_by_index(6));
|
||||
pal.set_color("editor_class", get_color_by_index(6));
|
||||
pal.set_color("editor_interface", get_color_by_index(6));
|
||||
pal.set_color("editor_enum", get_color_by_index(6));
|
||||
pal.set_color("editor_namespace", get_color_by_index(4));
|
||||
pal.set_color("editor_attribute", get_color_by_index(11));
|
||||
pal.set_color("editor_decorator", get_color_by_index(11));
|
||||
pal.set_color("editor_tag", get_color_by_index(1));
|
||||
pal.set_color("editor_punctuation", get_color_by_index(7));
|
||||
pal.set_color("editor_link", get_color_by_index(4));
|
||||
pal.set_color("editor_regex", get_color_by_index(5));
|
||||
pal.set_color("editor_escape_character", get_color_by_index(3));
|
||||
|
||||
// Editor - Diagnostics
|
||||
pal.set_color("editor_invalid", get_color_by_index(1));
|
||||
pal.set_color("editor_error", get_color_by_index(1));
|
||||
pal.set_color("editor_error_background", get_color_by_index(0));
|
||||
pal.set_color("editor_warning", get_color_by_index(3));
|
||||
pal.set_color("editor_success", get_color_by_index(2));
|
||||
pal.set_color("editor_warning_background", get_color_by_index(0));
|
||||
pal.set_color("editor_info", get_color_by_index(4));
|
||||
pal.set_color("editor_info_background", get_color_by_index(0));
|
||||
pal.set_color("editor_hint", get_color_by_index(2));
|
||||
pal.set_color("editor_hint_background", get_color_by_index(0));
|
||||
|
||||
// Editor - UI Elements
|
||||
pal.set_color("editor_active_line_border", get_color_by_index(8));
|
||||
pal.set_color("editor_indent_guide", get_color_by_index(8));
|
||||
pal.set_color("editor_indent_guide_active", get_color_by_index(7));
|
||||
pal.set_color("editor_bracket_match", get_color_by_index(6));
|
||||
pal.set_color("editor_search_match", get_color_by_index(3));
|
||||
pal.set_color("editor_search_match_active", get_color_by_index(3));
|
||||
pal.set_color("editor_find_range_highlight", get_color_by_index(3));
|
||||
|
||||
// Editor - Diff
|
||||
pal.set_color("editor_deleted", get_color_by_index(1));
|
||||
pal.set_color("editor_inserted", get_color_by_index(2));
|
||||
pal.set_color("editor_modified", get_color_by_index(3));
|
||||
pal.set_color("editor_ignored", get_color_by_index(8));
|
||||
pal.set_color("editor_folded_background", get_color_by_index(8));
|
||||
|
||||
return pal;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#ifdef _WIN32
|
||||
#define popen _popen
|
||||
#define pclose _pclose
|
||||
#endif
|
||||
|
||||
namespace clrsync::core
|
||||
{
|
||||
static std::string run_command_capture_output(const std::string &cmd)
|
||||
@@ -100,21 +105,72 @@ static palette parse_matugen_output(const std::string &out, const matugen_genera
|
||||
{"error", "error"},
|
||||
{"on_error", "on_error"},
|
||||
|
||||
// Editor - Basic
|
||||
{"editor_background", "background"},
|
||||
{"editor_main", "on_surface"},
|
||||
{"editor_foreground", "on_surface"},
|
||||
{"editor_line_highlight", "surface_container"},
|
||||
{"editor_selection", "primary_container"},
|
||||
{"editor_selection_inactive", "surface_container_low"},
|
||||
{"editor_cursor", "on_surface"},
|
||||
{"editor_whitespace", "outline_variant"},
|
||||
|
||||
// Editor - Gutter
|
||||
{"editor_gutter_background", "background"},
|
||||
{"editor_gutter_foreground", "outline"},
|
||||
{"editor_line_number", "outline"},
|
||||
{"editor_line_number_active", "on_surface"},
|
||||
|
||||
// Editor - Syntax
|
||||
{"editor_comment", "outline"},
|
||||
{"editor_string", "tertiary"},
|
||||
{"editor_emphasis", "primary"},
|
||||
{"editor_command", "secondary"},
|
||||
{"editor_number", "secondary"},
|
||||
{"editor_boolean", "secondary"},
|
||||
{"editor_keyword", "primary"},
|
||||
{"editor_operator", "on_surface"},
|
||||
{"editor_function", "tertiary_container"},
|
||||
{"editor_variable", "on_surface"},
|
||||
{"editor_parameter", "tertiary"},
|
||||
{"editor_property", "tertiary"},
|
||||
{"editor_constant", "secondary"},
|
||||
{"editor_type", "primary"},
|
||||
{"editor_class", "primary"},
|
||||
{"editor_interface", "primary"},
|
||||
{"editor_enum", "primary"},
|
||||
{"editor_namespace", "primary_container"},
|
||||
{"editor_attribute", "tertiary_container"},
|
||||
{"editor_decorator", "tertiary_container"},
|
||||
{"editor_tag", "error"},
|
||||
{"editor_punctuation", "on_surface"},
|
||||
{"editor_link", "primary_container"},
|
||||
{"editor_regex", "secondary_container"},
|
||||
{"editor_escape_character", "secondary"},
|
||||
|
||||
// Editor - Diagnostics
|
||||
{"editor_invalid", "error"},
|
||||
{"editor_error", "error"},
|
||||
{"editor_error_background", "error_container"},
|
||||
{"editor_warning", "secondary"},
|
||||
{"editor_success", "primary"},
|
||||
{"editor_disabled", "outline_variant"},
|
||||
{"editor_inactive", "outline_variant"},
|
||||
{"editor_line_number", "outline"},
|
||||
{"editor_selected", "primary_container"},
|
||||
{"editor_selection_inactive", "surface_container_low"},
|
||||
{"editor_warning_background", "secondary_container"},
|
||||
{"editor_info", "tertiary"},
|
||||
{"editor_info_background", "tertiary_container"},
|
||||
{"editor_hint", "primary"},
|
||||
{"editor_hint_background", "primary_container"},
|
||||
|
||||
// Editor - UI Elements
|
||||
{"editor_active_line_border", "outline_variant"},
|
||||
{"editor_indent_guide", "outline_variant"},
|
||||
{"editor_indent_guide_active", "outline"},
|
||||
{"editor_bracket_match", "primary"},
|
||||
{"editor_search_match", "tertiary_container"},
|
||||
{"editor_search_match_active", "tertiary"},
|
||||
{"editor_find_range_highlight", "tertiary_container"},
|
||||
|
||||
// Editor - Diff
|
||||
{"editor_deleted", "error"},
|
||||
{"editor_inserted", "primary"},
|
||||
{"editor_modified", "secondary"},
|
||||
{"editor_ignored", "outline_variant"},
|
||||
{"editor_folded_background", "surface_container"},
|
||||
|
||||
{"base00", "background"},
|
||||
{"base01", "surface_container_lowest"},
|
||||
|
||||
@@ -15,32 +15,38 @@ void apply_to_editor(TextEditor &editor, const clrsync::core::palette ¤t)
|
||||
|
||||
auto palette = editor.GetPalette();
|
||||
|
||||
palette[int(TextEditor::PaletteIndex::Default)] = get_color_u32("editor_main");
|
||||
palette[int(TextEditor::PaletteIndex::Keyword)] = get_color_u32("editor_command");
|
||||
palette[int(TextEditor::PaletteIndex::Number)] = get_color_u32("editor_warning");
|
||||
// Basic syntax
|
||||
palette[int(TextEditor::PaletteIndex::Default)] = get_color_u32("editor_foreground");
|
||||
palette[int(TextEditor::PaletteIndex::Keyword)] = get_color_u32("editor_keyword");
|
||||
palette[int(TextEditor::PaletteIndex::Number)] = get_color_u32("editor_number");
|
||||
palette[int(TextEditor::PaletteIndex::String)] = get_color_u32("editor_string");
|
||||
palette[int(TextEditor::PaletteIndex::CharLiteral)] = get_color_u32("editor_string");
|
||||
palette[int(TextEditor::PaletteIndex::Punctuation)] = get_color_u32("editor_main");
|
||||
palette[int(TextEditor::PaletteIndex::Preprocessor)] = get_color_u32("editor_emphasis");
|
||||
palette[int(TextEditor::PaletteIndex::Identifier)] = get_color_u32("editor_main");
|
||||
palette[int(TextEditor::PaletteIndex::KnownIdentifier)] = get_color_u32("editor_link");
|
||||
palette[int(TextEditor::PaletteIndex::PreprocIdentifier)] = get_color_u32("editor_link");
|
||||
palette[int(TextEditor::PaletteIndex::Punctuation)] = get_color_u32("editor_punctuation");
|
||||
palette[int(TextEditor::PaletteIndex::Preprocessor)] = get_color_u32("editor_attribute");
|
||||
palette[int(TextEditor::PaletteIndex::Identifier)] = get_color_u32("editor_variable");
|
||||
palette[int(TextEditor::PaletteIndex::KnownIdentifier)] = get_color_u32("editor_function");
|
||||
palette[int(TextEditor::PaletteIndex::PreprocIdentifier)] = get_color_u32("editor_constant");
|
||||
|
||||
// Comments
|
||||
palette[int(TextEditor::PaletteIndex::Comment)] = get_color_u32("editor_comment");
|
||||
palette[int(TextEditor::PaletteIndex::MultiLineComment)] = get_color_u32("editor_comment");
|
||||
|
||||
// Background and cursor
|
||||
palette[int(TextEditor::PaletteIndex::Background)] = get_color_u32("editor_background");
|
||||
palette[int(TextEditor::PaletteIndex::Cursor)] = get_color_u32("cursor");
|
||||
palette[int(TextEditor::PaletteIndex::Cursor)] = get_color_u32("editor_cursor");
|
||||
|
||||
palette[int(TextEditor::PaletteIndex::Selection)] = get_color_u32("editor_selected");
|
||||
palette[int(TextEditor::PaletteIndex::ErrorMarker)] = get_color_u32("editor_error");
|
||||
// Selection
|
||||
palette[int(TextEditor::PaletteIndex::Selection)] = get_color_u32("editor_selection");
|
||||
palette[int(TextEditor::PaletteIndex::ErrorMarker)] = get_color_u32("editor_error_background");
|
||||
palette[int(TextEditor::PaletteIndex::Breakpoint)] = get_color_u32("editor_error");
|
||||
|
||||
// Line numbers
|
||||
palette[int(TextEditor::PaletteIndex::LineNumber)] = get_color_u32("editor_line_number");
|
||||
|
||||
palette[int(TextEditor::PaletteIndex::CurrentLineFill)] = get_color_u32("surface_variant");
|
||||
palette[int(TextEditor::PaletteIndex::CurrentLineFillInactive)] = get_color_u32("surface");
|
||||
palette[int(TextEditor::PaletteIndex::CurrentLineEdge)] = get_color_u32("border_focused");
|
||||
// Current line highlight
|
||||
palette[int(TextEditor::PaletteIndex::CurrentLineFill)] = get_color_u32("editor_line_highlight");
|
||||
palette[int(TextEditor::PaletteIndex::CurrentLineFillInactive)] = get_color_u32("editor_folded_background");
|
||||
palette[int(TextEditor::PaletteIndex::CurrentLineEdge)] = get_color_u32("editor_active_line_border");
|
||||
|
||||
editor.SetPalette(palette);
|
||||
}
|
||||
|
||||
@@ -184,19 +184,43 @@ void color_table_renderer::render(const clrsync::core::palette ¤t,
|
||||
|
||||
draw_table("General UI", "##general_ui",
|
||||
{"background", "on_background", "surface", "on_surface", "surface_variant",
|
||||
"on_surface_variant", "foreground", "cursor", "accent", "accent_secondary"});
|
||||
|
||||
draw_table("Borders", "##borders", {"border_focused", "border"});
|
||||
"on_surface_variant", "border_focused", "border", "foreground", "cursor", "accent",
|
||||
"accent_secondary"});
|
||||
|
||||
draw_table(
|
||||
"Semantic Colors", "##semantic",
|
||||
{"success", "info", "warning", "error", "on_success", "on_info", "on_warning", "on_error"});
|
||||
|
||||
draw_table("Editor", "##editor",
|
||||
{"editor_background", "editor_command", "editor_comment", "editor_disabled",
|
||||
"editor_emphasis", "editor_error", "editor_inactive", "editor_line_number",
|
||||
"editor_link", "editor_main", "editor_selected", "editor_selection_inactive",
|
||||
"editor_string", "editor_success", "editor_warning"});
|
||||
draw_table("Editor - Basic", "##editor_basic",
|
||||
{"editor_background", "editor_foreground", "editor_line_highlight",
|
||||
"editor_selection", "editor_selection_inactive", "editor_cursor",
|
||||
"editor_whitespace"});
|
||||
|
||||
draw_table("Editor - Gutter", "##editor_gutter",
|
||||
{"editor_gutter_background", "editor_gutter_foreground", "editor_line_number",
|
||||
"editor_line_number_active"});
|
||||
|
||||
draw_table("Editor - Syntax", "##editor_syntax",
|
||||
{"editor_comment", "editor_string", "editor_number", "editor_boolean",
|
||||
"editor_keyword", "editor_operator", "editor_function", "editor_variable",
|
||||
"editor_parameter", "editor_property", "editor_constant", "editor_type",
|
||||
"editor_class", "editor_interface", "editor_enum", "editor_namespace",
|
||||
"editor_attribute", "editor_decorator", "editor_tag", "editor_punctuation",
|
||||
"editor_link", "editor_regex", "editor_escape_character"});
|
||||
|
||||
draw_table("Editor - Diagnostics", "##editor_diagnostics",
|
||||
{"editor_invalid", "editor_error", "editor_error_background", "editor_warning",
|
||||
"editor_warning_background", "editor_info", "editor_info_background",
|
||||
"editor_hint", "editor_hint_background"});
|
||||
|
||||
draw_table("Editor - UI Elements", "##editor_ui",
|
||||
{"editor_active_line_border", "editor_indent_guide", "editor_indent_guide_active",
|
||||
"editor_bracket_match", "editor_search_match", "editor_search_match_active",
|
||||
"editor_find_range_highlight"});
|
||||
|
||||
draw_table("Editor - Diff", "##editor_diff",
|
||||
{"editor_deleted", "editor_inserted", "editor_modified", "editor_ignored",
|
||||
"editor_folded_background"});
|
||||
|
||||
draw_table("Terminal (Base16)", "##terminal",
|
||||
{"base00", "base01", "base02", "base03", "base04", "base05", "base06", "base07",
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "gui/ui_manager.hpp"
|
||||
#include "imgui.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <ranges>
|
||||
@@ -166,6 +167,20 @@ void template_editor::update_autocomplete_suggestions()
|
||||
return;
|
||||
}
|
||||
|
||||
m_autocomplete_end_brace_pos = -1;
|
||||
for (int i = col; i < (int)line.length(); ++i)
|
||||
{
|
||||
if (line[i] == '}')
|
||||
{
|
||||
m_autocomplete_end_brace_pos = i;
|
||||
break;
|
||||
}
|
||||
else if (line[i] == '{' || line[i] == ' ' || line[i] == '\t')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_autocomplete_dismissed)
|
||||
{
|
||||
bool should_reset_dismissal = false;
|
||||
@@ -211,8 +226,7 @@ void template_editor::update_autocomplete_suggestions()
|
||||
{
|
||||
for (const auto &fmt : COLOR_FORMATS)
|
||||
{
|
||||
if (format_prefix.empty() || fmt.find(format_prefix) == 0 ||
|
||||
fmt.find(format_prefix) != std::string::npos)
|
||||
if (format_prefix.empty() || fmt.find(format_prefix) == 0)
|
||||
{
|
||||
m_autocomplete_suggestions.push_back(color_key + "." + fmt);
|
||||
}
|
||||
@@ -221,26 +235,50 @@ void template_editor::update_autocomplete_suggestions()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<std::pair<std::string, int>> scored_suggestions;
|
||||
|
||||
for (size_t i = 0; i < clrsync::core::NUM_COLOR_KEYS; ++i)
|
||||
{
|
||||
std::string key = clrsync::core::COLOR_KEYS[i];
|
||||
if (m_autocomplete_prefix.empty() || key.find(m_autocomplete_prefix) == 0 ||
|
||||
key.find(m_autocomplete_prefix) != std::string::npos)
|
||||
|
||||
if (m_autocomplete_prefix.empty())
|
||||
{
|
||||
m_autocomplete_suggestions.push_back(key);
|
||||
scored_suggestions.push_back({key, 0});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (key.find(m_autocomplete_prefix) == 0)
|
||||
{
|
||||
scored_suggestions.push_back({key, 100});
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t pos = key.find("_" + m_autocomplete_prefix);
|
||||
if (pos != std::string::npos)
|
||||
{
|
||||
scored_suggestions.push_back({key, 50});
|
||||
}
|
||||
else if (key.find(m_autocomplete_prefix) != std::string::npos)
|
||||
{
|
||||
scored_suggestions.push_back({key, 25});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(scored_suggestions.begin(), scored_suggestions.end(),
|
||||
[](const auto &a, const auto &b) {
|
||||
if (a.second != b.second)
|
||||
return a.second > b.second;
|
||||
return a.first < b.first;
|
||||
});
|
||||
|
||||
for (const auto &[key, score] : scored_suggestions)
|
||||
{
|
||||
m_autocomplete_suggestions.push_back(key);
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(m_autocomplete_suggestions.begin(), m_autocomplete_suggestions.end(),
|
||||
[this](const std::string &a, const std::string &b) {
|
||||
bool a_prefix = a.find(m_autocomplete_prefix) == 0;
|
||||
bool b_prefix = b.find(m_autocomplete_prefix) == 0;
|
||||
if (a_prefix != b_prefix)
|
||||
return a_prefix;
|
||||
return a < b;
|
||||
});
|
||||
|
||||
m_show_autocomplete = !m_autocomplete_suggestions.empty();
|
||||
if (m_show_autocomplete && m_autocomplete_selected >= (int)m_autocomplete_suggestions.size())
|
||||
{
|
||||
@@ -265,16 +303,19 @@ void template_editor::render_autocomplete(const ImVec2 &editor_pos)
|
||||
popup_pos.y = editor_pos.y + ((cursor.mLine + 1) * line_height);
|
||||
|
||||
ImGui::SetNextWindowPos(popup_pos, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(ImVec2(300, 0));
|
||||
|
||||
float max_width = 350.0f;
|
||||
float min_width = 250.0f;
|
||||
ImGui::SetNextWindowSize(ImVec2(max_width, 0));
|
||||
|
||||
ImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize |
|
||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings |
|
||||
ImGuiWindowFlags_NoFocusOnAppearing |
|
||||
ImGuiWindowFlags_AlwaysAutoResize;
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(6, 6));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 6.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 2));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(8, 8));
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4, 3));
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, m_autocomplete_bg_color);
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, m_autocomplete_border_color);
|
||||
|
||||
@@ -282,15 +323,20 @@ void template_editor::render_autocomplete(const ImVec2 &editor_pos)
|
||||
{
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_autocomplete_dim_text_color);
|
||||
if (m_autocomplete_prefix.find('.') != std::string::npos)
|
||||
ImGui::Text("Formats");
|
||||
ImGui::Text("Color Formats");
|
||||
else
|
||||
ImGui::Text("Color Keys");
|
||||
ImGui::Text("Color Keys (%d)", (int)m_autocomplete_suggestions.size());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::Separator();
|
||||
|
||||
int max_items = std::min((int)m_autocomplete_suggestions.size(), 8);
|
||||
int max_visible = std::min((int)m_autocomplete_suggestions.size(), 12);
|
||||
|
||||
if (m_autocomplete_selected >= max_visible)
|
||||
{
|
||||
m_autocomplete_selected = max_visible - 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < max_items; ++i)
|
||||
for (int i = 0; i < max_visible; ++i)
|
||||
{
|
||||
const auto &suggestion = m_autocomplete_suggestions[i];
|
||||
bool is_selected = (i == m_autocomplete_selected);
|
||||
@@ -316,18 +362,128 @@ void template_editor::render_autocomplete(const ImVec2 &editor_pos)
|
||||
|
||||
std::string display_text = " " + suggestion;
|
||||
|
||||
std::string color_key = suggestion;
|
||||
size_t dot_pos = suggestion.find('.');
|
||||
if (dot_pos != std::string::npos)
|
||||
{
|
||||
color_key = suggestion.substr(0, dot_pos);
|
||||
}
|
||||
|
||||
bool has_color = false;
|
||||
clrsync::core::color palette_color;
|
||||
if (m_current_palette.colors().count(color_key) > 0)
|
||||
{
|
||||
has_color = true;
|
||||
palette_color = m_current_palette.colors().at(color_key);
|
||||
}
|
||||
|
||||
if (ImGui::Selectable(display_text.c_str(), is_selected, ImGuiSelectableFlags_None,
|
||||
ImVec2(0, 0)))
|
||||
{
|
||||
auto start = m_autocomplete_start_pos;
|
||||
auto end = m_editor.GetCursorPosition();
|
||||
auto cursor_pos = m_editor.GetCursorPosition();
|
||||
|
||||
TextEditor::Coordinates end;
|
||||
if (m_autocomplete_end_brace_pos >= 0)
|
||||
{
|
||||
end = TextEditor::Coordinates(cursor_pos.mLine, m_autocomplete_end_brace_pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
end = cursor_pos;
|
||||
}
|
||||
|
||||
std::string insert_text = suggestion;
|
||||
if (m_autocomplete_end_brace_pos < 0)
|
||||
{
|
||||
insert_text += "}";
|
||||
}
|
||||
|
||||
const char* old_clipboard = ImGui::GetClipboardText();
|
||||
std::string saved_clipboard = old_clipboard ? old_clipboard : "";
|
||||
|
||||
ImGui::SetClipboardText(insert_text.c_str());
|
||||
|
||||
m_editor.SetSelection(start, end);
|
||||
m_editor.Delete();
|
||||
m_editor.InsertText(suggestion + "}");
|
||||
m_editor.Paste();
|
||||
|
||||
ImGui::SetClipboardText(saved_clipboard.c_str());
|
||||
|
||||
m_show_autocomplete = false;
|
||||
m_autocomplete_dismissed = false;
|
||||
}
|
||||
|
||||
if (has_color)
|
||||
{
|
||||
ImVec2 item_min = ImGui::GetItemRectMin();
|
||||
ImVec2 item_max = ImGui::GetItemRectMax();
|
||||
|
||||
const float preview_size = ImGui::GetTextLineHeight() * 0.7f;
|
||||
const float padding = 4.0f;
|
||||
|
||||
ImVec2 preview_pos;
|
||||
preview_pos.x = item_max.x - preview_size - padding;
|
||||
preview_pos.y = item_min.y + (item_max.y - item_min.y - preview_size) * 0.5f;
|
||||
|
||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||
|
||||
auto rgba = palette_color.to_rgba();
|
||||
ImU32 color_u32 = IM_COL32(rgba.r, rgba.g, rgba.b, rgba.a);
|
||||
|
||||
float r = rgba.r / 255.0f;
|
||||
float g = rgba.g / 255.0f;
|
||||
float b = rgba.b / 255.0f;
|
||||
|
||||
r = (r <= 0.03928f) ? r / 12.92f : std::pow((r + 0.055f) / 1.055f, 2.4f);
|
||||
g = (g <= 0.03928f) ? g / 12.92f : std::pow((g + 0.055f) / 1.055f, 2.4f);
|
||||
b = (b <= 0.03928f) ? b / 12.92f : std::pow((b + 0.055f) / 1.055f, 2.4f);
|
||||
|
||||
float luminance = 0.2126f * r + 0.7152f * g + 0.0722f * b;
|
||||
|
||||
ImVec4 bg_color = is_selected ? m_autocomplete_selected_color : m_autocomplete_bg_color;
|
||||
float bg_r = bg_color.x;
|
||||
float bg_g = bg_color.y;
|
||||
float bg_b = bg_color.z;
|
||||
|
||||
bg_r = (bg_r <= 0.03928f) ? bg_r / 12.92f : std::pow((bg_r + 0.055f) / 1.055f, 2.4f);
|
||||
bg_g = (bg_g <= 0.03928f) ? bg_g / 12.92f : std::pow((bg_g + 0.055f) / 1.055f, 2.4f);
|
||||
bg_b = (bg_b <= 0.03928f) ? bg_b / 12.92f : std::pow((bg_b + 0.055f) / 1.055f, 2.4f);
|
||||
|
||||
float bg_luminance = 0.2126f * bg_r + 0.7152f * bg_g + 0.0722f * bg_b;
|
||||
|
||||
float contrast = (std::max(luminance, bg_luminance) + 0.05f) /
|
||||
(std::min(luminance, bg_luminance) + 0.05f);
|
||||
|
||||
if (contrast < 2.0f)
|
||||
{
|
||||
ImU32 contrast_bg = (bg_luminance > 0.5f) ? IM_COL32(0, 0, 0, 180) : IM_COL32(255, 255, 255, 180);
|
||||
const float bg_padding = 2.0f;
|
||||
draw_list->AddRectFilled(
|
||||
ImVec2(preview_pos.x - bg_padding, preview_pos.y - bg_padding),
|
||||
ImVec2(preview_pos.x + preview_size + bg_padding, preview_pos.y + preview_size + bg_padding),
|
||||
contrast_bg,
|
||||
2.0f
|
||||
);
|
||||
}
|
||||
|
||||
draw_list->AddRectFilled(
|
||||
preview_pos,
|
||||
ImVec2(preview_pos.x + preview_size, preview_pos.y + preview_size),
|
||||
color_u32,
|
||||
2.0f
|
||||
);
|
||||
|
||||
ImU32 border_color = IM_COL32(255, 255, 255, 60);
|
||||
draw_list->AddRect(
|
||||
preview_pos,
|
||||
ImVec2(preview_pos.x + preview_size, preview_pos.y + preview_size),
|
||||
border_color,
|
||||
2.0f,
|
||||
0,
|
||||
1.0f
|
||||
);
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
if (is_selected && ImGui::IsWindowAppearing())
|
||||
@@ -336,17 +492,17 @@ void template_editor::render_autocomplete(const ImVec2 &editor_pos)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_autocomplete_suggestions.size() > 8)
|
||||
if (m_autocomplete_suggestions.size() > 12)
|
||||
{
|
||||
ImGui::Separator();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_autocomplete_dim_text_color);
|
||||
ImGui::Text(" +%d more", (int)m_autocomplete_suggestions.size() - 8);
|
||||
ImGui::Text(" +%d more (keep typing to filter)", (int)m_autocomplete_suggestions.size() - 12);
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
ImGui::Separator();
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, m_autocomplete_dim_text_color);
|
||||
ImGui::Text(" Tab/Enter: accept | Esc: dismiss");
|
||||
ImGui::Text(" Tab/Enter: accept | Esc: dismiss | \u2191\u2193: navigate");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
ImGui::End();
|
||||
@@ -470,7 +626,7 @@ void template_editor::render_editor()
|
||||
}
|
||||
else if (m_show_autocomplete && !m_autocomplete_suggestions.empty())
|
||||
{
|
||||
int max_visible = std::min((int)m_autocomplete_suggestions.size(), 8);
|
||||
int max_visible = std::min((int)m_autocomplete_suggestions.size(), 12);
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_DownArrow, false))
|
||||
{
|
||||
@@ -485,13 +641,40 @@ void template_editor::render_editor()
|
||||
else if (ImGui::IsKeyPressed(ImGuiKey_Tab, false) ||
|
||||
ImGui::IsKeyPressed(ImGuiKey_Enter, false))
|
||||
{
|
||||
auto start = m_autocomplete_start_pos;
|
||||
auto end = m_editor.GetCursorPosition();
|
||||
m_editor.SetSelection(start, end);
|
||||
m_editor.Delete();
|
||||
m_editor.InsertText(m_autocomplete_suggestions[m_autocomplete_selected] + "}");
|
||||
m_show_autocomplete = false;
|
||||
m_autocomplete_dismissed = false;
|
||||
if (m_autocomplete_selected >= 0 && m_autocomplete_selected < (int)m_autocomplete_suggestions.size())
|
||||
{
|
||||
auto start = m_autocomplete_start_pos;
|
||||
auto cursor_pos = m_editor.GetCursorPosition();
|
||||
|
||||
TextEditor::Coordinates end;
|
||||
if (m_autocomplete_end_brace_pos >= 0)
|
||||
{
|
||||
end = TextEditor::Coordinates(cursor_pos.mLine, m_autocomplete_end_brace_pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
end = cursor_pos;
|
||||
}
|
||||
|
||||
std::string insert_text = m_autocomplete_suggestions[m_autocomplete_selected];
|
||||
if (m_autocomplete_end_brace_pos < 0)
|
||||
{
|
||||
insert_text += "}";
|
||||
}
|
||||
|
||||
const char* old_clipboard = ImGui::GetClipboardText();
|
||||
std::string saved_clipboard = old_clipboard ? old_clipboard : "";
|
||||
|
||||
ImGui::SetClipboardText(insert_text.c_str());
|
||||
|
||||
m_editor.SetSelection(start, end);
|
||||
m_editor.Paste();
|
||||
|
||||
ImGui::SetClipboardText(saved_clipboard.c_str());
|
||||
|
||||
m_show_autocomplete = false;
|
||||
m_autocomplete_dismissed = false;
|
||||
}
|
||||
consume_keys = true;
|
||||
}
|
||||
}
|
||||
@@ -505,6 +688,54 @@ void template_editor::render_editor()
|
||||
|
||||
m_editor.Render("##TemplateEditor", ImVec2(0, 0), true);
|
||||
|
||||
if (ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left) && m_editor.HasSelection())
|
||||
{
|
||||
std::string selected_text = m_editor.GetSelectedText();
|
||||
|
||||
if (!selected_text.empty())
|
||||
{
|
||||
bool starts_with_brace = selected_text.front() == '{';
|
||||
bool ends_with_brace = selected_text.back() == '}';
|
||||
|
||||
if (starts_with_brace || ends_with_brace)
|
||||
{
|
||||
auto cursor = m_editor.GetCursorPosition();
|
||||
std::string line = m_editor.GetCurrentLineText();
|
||||
|
||||
int brace_start = -1;
|
||||
int brace_end = -1;
|
||||
|
||||
for (int i = cursor.mColumn - 1; i >= 0; --i)
|
||||
{
|
||||
if (i < (int)line.length() && line[i] == '{')
|
||||
{
|
||||
brace_start = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (brace_start >= 0)
|
||||
{
|
||||
for (int i = brace_start + 1; i < (int)line.length(); ++i)
|
||||
{
|
||||
if (line[i] == '}')
|
||||
{
|
||||
brace_end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (brace_start >= 0 && brace_end > brace_start + 1)
|
||||
{
|
||||
TextEditor::Coordinates sel_start(cursor.mLine, brace_start + 1);
|
||||
TextEditor::Coordinates sel_end(cursor.mLine, brace_end);
|
||||
m_editor.SetSelection(sel_start, sel_end);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (consume_keys)
|
||||
{
|
||||
m_editor.SetHandleKeyboardInputs(true);
|
||||
|
||||
@@ -55,6 +55,7 @@ class template_editor
|
||||
bool m_autocomplete_dismissed{false};
|
||||
TextEditor::Coordinates m_dismiss_position;
|
||||
int m_dismiss_brace_pos{-1};
|
||||
int m_autocomplete_end_brace_pos{-1};
|
||||
std::vector<std::string> m_autocomplete_suggestions;
|
||||
int m_autocomplete_selected{0};
|
||||
std::string m_autocomplete_prefix;
|
||||
|
||||
Reference in New Issue
Block a user