create colour scheme tructure
This commit is contained in:
parent
2b558d4e4d
commit
61400a7c9b
|
|
@ -355,13 +355,13 @@ Source of truth for the step-by-step rebuild. Keep this concise and up to date.
|
|||
- [x] Convert to modern format (keep hex, 256-color, ANSI mappings)
|
||||
|
||||
## Phase 11.3 — Create colorscheme structure
|
||||
- [ ] Create directory structure:
|
||||
- [x] Create directory structure:
|
||||
- `colors/paper-tonic-modern.lua` (entry point)
|
||||
- `lua/paper-tonic-modern/init.lua` (main logic)
|
||||
- `lua/paper-tonic-modern/colors.lua` (palette)
|
||||
- `lua/paper-tonic-modern/groups/` (highlight group definitions)
|
||||
- [ ] Create helper function for setting highlights
|
||||
- [ ] Set up colorscheme loading mechanism
|
||||
- [x] Create helper function for setting highlights
|
||||
- [x] Set up colorscheme loading mechanism
|
||||
|
||||
## Phase 11.4 — Base vim highlight groups
|
||||
- [ ] Create `lua/paper-tonic-modern/groups/editor.lua`
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -90,6 +90,16 @@ Record every decision here with a short rationale. Append new entries; do not re
|
|||
- **Format**: Each color defined as `{hex, 256-color, ansi}` tuple for broad terminal compatibility
|
||||
- **Philosophy**: Light, paper-like theme with subtle colors for long reading sessions
|
||||
- **Next steps**: Phase 11.3 will create colorscheme structure and entry point
|
||||
- 2025-12-11: Colorscheme Phase 11.3:
|
||||
- **Colorscheme structure**: Created complete modular colorscheme architecture
|
||||
- **Entry point**: `colors/paper-tonic-modern.lua` properly resets and loads colorscheme
|
||||
- **Main module**: `lua/paper-tonic-modern/init.lua` with helper functions for setting highlights
|
||||
- **Helper functions**: `M.highlight()` for single groups, `M.highlight_all()` for batch operations
|
||||
- **Color conversion**: Smart conversion between gui/cterm/ansi formats
|
||||
- **Group modules**: Created stub files for editor, syntax, treesitter, semantic, lsp, and plugins
|
||||
- **Loading order**: Structured to load groups in logical sequence (editor → syntax → treesitter → semantic → lsp → plugins)
|
||||
- **Validation**: Colorscheme loads successfully, highlights applied correctly
|
||||
- **Language color consistency**: All documentation updated to reflect that each language maintains its color identity everywhere (PHP=primary, HTML=blue, CSS=green, templates=magenta)
|
||||
|
||||
## Project-Local Configuration (design)
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
-- Paper Tonic Modern
|
||||
-- A light, paper-like colorscheme for Neovim
|
||||
-- Forked from the original Paper Tonic with modern Lua implementation
|
||||
|
||||
-- Reset highlights and syntax
|
||||
vim.cmd('highlight clear')
|
||||
if vim.fn.exists('syntax_on') then
|
||||
vim.cmd('syntax reset')
|
||||
end
|
||||
|
||||
-- Set colorscheme name
|
||||
vim.g.colors_name = 'paper-tonic-modern'
|
||||
|
||||
-- Set background to light
|
||||
vim.o.background = 'light'
|
||||
|
||||
-- Load the colorscheme
|
||||
require('paper-tonic-modern').load()
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
-- Paper Tonic Modern - Editor Highlight Groups
|
||||
-- Base Vim/Neovim UI elements
|
||||
|
||||
local colors = require('paper-tonic-modern.colors')
|
||||
|
||||
return {
|
||||
-- Core editor elements (to be implemented in Phase 11.4)
|
||||
Normal = { fg = colors.fg, bg = colors.bg },
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
-- Paper Tonic Modern - LSP Highlight Groups
|
||||
-- LSP diagnostics and UI elements
|
||||
|
||||
local colors = require('paper-tonic-modern.colors')
|
||||
|
||||
return {
|
||||
-- LSP groups (to be implemented in Phase 11.8)
|
||||
DiagnosticError = { fg = colors.alert_strong },
|
||||
DiagnosticWarn = { fg = colors.alert },
|
||||
DiagnosticInfo = { fg = colors.question },
|
||||
DiagnosticHint = { fg = colors.fg },
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
-- Paper Tonic Modern - Plugin Highlight Groups
|
||||
-- Highlights for various plugins (Telescope, Gitsigns, cmp, etc.)
|
||||
|
||||
local colors = require('paper-tonic-modern.colors')
|
||||
|
||||
return {
|
||||
-- Plugin groups (to be implemented in Phase 11.8)
|
||||
-- Telescope, Gitsigns, nvim-cmp, Oil.nvim, etc.
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
-- Paper Tonic Modern - Semantic Highlight Groups
|
||||
-- Custom semantic captures for language-specific highlighting
|
||||
|
||||
local colors = require('paper-tonic-modern.colors')
|
||||
|
||||
return {
|
||||
-- Semantic groups (to be implemented in Phase 11.7)
|
||||
-- Custom captures like @CssClassName, @CssIdentifier, etc.
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
-- Paper Tonic Modern - Syntax Highlight Groups
|
||||
-- Traditional Vim syntax groups
|
||||
|
||||
local colors = require('paper-tonic-modern.colors')
|
||||
|
||||
return {
|
||||
-- Syntax groups (to be implemented in Phase 11.4)
|
||||
Comment = { fg = colors.fg_weak },
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
-- Paper Tonic Modern - TreeSitter Highlight Groups
|
||||
-- Modern @* highlight groups for TreeSitter
|
||||
|
||||
local colors = require('paper-tonic-modern.colors')
|
||||
|
||||
return {
|
||||
-- TreeSitter groups (to be implemented in Phase 11.5)
|
||||
['@comment'] = { fg = colors.fg_weak },
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
-- Paper Tonic Modern - Main Module
|
||||
-- Provides colorscheme loading and highlight helper functions
|
||||
|
||||
local M = {}
|
||||
|
||||
-- Import color palette
|
||||
local colors = require('paper-tonic-modern.colors')
|
||||
|
||||
-- ============================================================================
|
||||
-- Helper Functions
|
||||
-- ============================================================================
|
||||
|
||||
-- Convert color table {hex, 256, ansi} to usable formats
|
||||
local function get_color(color_def, mode)
|
||||
if type(color_def) == 'string' then
|
||||
-- Already a string like 'NONE', 'FG', 'BG'
|
||||
return color_def
|
||||
end
|
||||
|
||||
if type(color_def) ~= 'table' then
|
||||
return 'NONE'
|
||||
end
|
||||
|
||||
-- mode: 'gui' for hex, 'cterm' for 256-color
|
||||
if mode == 'gui' then
|
||||
return color_def[1] or 'NONE'
|
||||
elseif mode == 'cterm' then
|
||||
return color_def[2] or 'NONE'
|
||||
else
|
||||
return 'NONE'
|
||||
end
|
||||
end
|
||||
|
||||
-- Set a highlight group
|
||||
-- spec = {
|
||||
-- fg = color_def, -- Foreground color
|
||||
-- bg = color_def, -- Background color
|
||||
-- sp = color_def, -- Special color (for undercurl, etc.)
|
||||
-- bold = boolean,
|
||||
-- italic = boolean,
|
||||
-- underline = boolean,
|
||||
-- undercurl = boolean,
|
||||
-- strikethrough = boolean,
|
||||
-- reverse = boolean,
|
||||
-- standout = boolean,
|
||||
-- }
|
||||
function M.highlight(group, spec)
|
||||
if type(spec) == 'string' then
|
||||
-- Link to another group
|
||||
vim.api.nvim_set_hl(0, group, { link = spec })
|
||||
return
|
||||
end
|
||||
|
||||
local hl = {}
|
||||
|
||||
-- Colors
|
||||
if spec.fg then
|
||||
hl.fg = get_color(spec.fg, 'gui')
|
||||
hl.ctermfg = get_color(spec.fg, 'cterm')
|
||||
end
|
||||
|
||||
if spec.bg then
|
||||
hl.bg = get_color(spec.bg, 'gui')
|
||||
hl.ctermbg = get_color(spec.bg, 'cterm')
|
||||
end
|
||||
|
||||
if spec.sp then
|
||||
hl.sp = get_color(spec.sp, 'gui')
|
||||
end
|
||||
|
||||
-- Styles
|
||||
if spec.bold then hl.bold = true end
|
||||
if spec.italic then hl.italic = true end
|
||||
if spec.underline then hl.underline = true end
|
||||
if spec.undercurl then hl.undercurl = true end
|
||||
if spec.strikethrough then hl.strikethrough = true end
|
||||
if spec.reverse then hl.reverse = true end
|
||||
if spec.standout then hl.standout = true end
|
||||
|
||||
vim.api.nvim_set_hl(0, group, hl)
|
||||
end
|
||||
|
||||
-- Convenience function to set multiple highlight groups
|
||||
function M.highlight_all(groups)
|
||||
for group, spec in pairs(groups) do
|
||||
M.highlight(group, spec)
|
||||
end
|
||||
end
|
||||
|
||||
-- ============================================================================
|
||||
-- Load Colorscheme
|
||||
-- ============================================================================
|
||||
|
||||
function M.load()
|
||||
-- Load highlight groups in order
|
||||
-- Each module returns a table of { group_name = spec }
|
||||
|
||||
-- Base editor highlights (Normal, StatusLine, etc.)
|
||||
local editor = require('paper-tonic-modern.groups.editor')
|
||||
M.highlight_all(editor)
|
||||
|
||||
-- Syntax highlights (Comment, Function, String, etc.)
|
||||
local syntax = require('paper-tonic-modern.groups.syntax')
|
||||
M.highlight_all(syntax)
|
||||
|
||||
-- TreeSitter highlights (@variable, @function, etc.)
|
||||
local treesitter = require('paper-tonic-modern.groups.treesitter')
|
||||
M.highlight_all(treesitter)
|
||||
|
||||
-- Semantic highlights (custom captures for CSS/HTML)
|
||||
local semantic = require('paper-tonic-modern.groups.semantic')
|
||||
M.highlight_all(semantic)
|
||||
|
||||
-- LSP highlights (diagnostics, references)
|
||||
local lsp = require('paper-tonic-modern.groups.lsp')
|
||||
M.highlight_all(lsp)
|
||||
|
||||
-- Plugin highlights (Telescope, Gitsigns, cmp, etc.)
|
||||
local plugins = require('paper-tonic-modern.groups.plugins')
|
||||
M.highlight_all(plugins)
|
||||
end
|
||||
|
||||
-- Export colors for use in other modules
|
||||
M.colors = colors
|
||||
|
||||
return M
|
||||
Loading…
Reference in New Issue