diff --git a/colors/paper-tonic-modern.lua b/colors/paper-tonic-modern.lua index 5865390..d6179e5 100644 --- a/colors/paper-tonic-modern.lua +++ b/colors/paper-tonic-modern.lua @@ -1,5 +1,5 @@ -- Paper Tonic Modern --- A light, paper-like colorscheme for Neovim +-- A paper-like colorscheme for Neovim supporting both light and dark modes -- Forked from the original Paper Tonic with modern Lua implementation -- Reset highlights and syntax @@ -11,8 +11,10 @@ end -- Set colorscheme name vim.g.colors_name = 'paper-tonic-modern' --- Set background to light -vim.o.background = 'light' +-- Set default background if not already set +if vim.o.background == '' then + vim.o.background = 'light' +end -- Load the colorscheme require('paper-tonic-modern').load() diff --git a/lua/paper-tonic-modern/colors.lua b/lua/paper-tonic-modern/colors.lua index 4bb99e5..e0196ed 100644 --- a/lua/paper-tonic-modern/colors.lua +++ b/lua/paper-tonic-modern/colors.lua @@ -1,6 +1,6 @@ -- Paper Tonic Modern - Color Palette -- Extracted from original Paper Tonic colorscheme --- Light, paper-like theme with subtle colors +-- Supports both light (paper-like) and dark modes local M = {} @@ -9,115 +9,177 @@ local M = {} -- 256: Integer 0-255 for 256-color terminals -- ansi: ANSI color name for basic 16-color terminals +-- Detect current background mode +local is_dark = vim.o.background == 'dark' + -- ============================================================================ -- Background Colors -- ============================================================================ --- Main background: pure white paper -M.bg = {'#ffffff', 255, 'white'} - --- Darkest background: used for very strong contrast elements -M.bg_darkest = {'#505050', 244, 'gray'} - --- UI background: slightly off-white for UI elements (statusline, etc.) -M.bg_ui = {'#efefef', 0, 'darkgray'} +if is_dark then + -- Dark mode: soft dark backgrounds + M.bg = {'#1a1a1a', 234, 'black'} + M.bg_darkest = {'#ffffff', 255, 'white'} -- Inverted: lightest for strong contrast + M.bg_ui = {'#2a2a2a', 236, 'darkgray'} +else + -- Light mode: pure white paper + M.bg = {'#ffffff', 255, 'white'} + M.bg_darkest = {'#505050', 244, 'gray'} + M.bg_ui = {'#efefef', 0, 'darkgray'} +end -- ============================================================================ -- Highlight Backgrounds (general) -- ============================================================================ --- Selection/highlight backgrounds (neutral gray tones) -M.bg_hl_strong = {"#dddddd", 17, "white"} -M.bg_hl = {"#eeeeee", 250, "white"} -M.bg_hl_weak = {"#f7f2f2", 250, "white"} - --- Special highlight backgrounds (cyan/blue tones - for LSP references, search, etc.) -M.bg_hl_special_strong = {"#a3e0ff", 17, "cyan"} -M.bg_hl_special = {"#d4f0ff", 250, "cyan"} -M.bg_hl_special_weak = {"#e0eaff", 250, "cyan"} - --- Alternative special highlight (green tones - for diff additions, etc.) -M.bg_hl_special_alt_strong = {"#74f283", 17, "cyan"} -M.bg_hl_special_alt = {"#bff2cd", 250, "cyan"} +if is_dark then + -- Dark mode: lighter backgrounds for highlights + M.bg_hl_strong = {"#3a3a3a", 237, "darkgray"} + M.bg_hl = {"#2a2a2a", 236, "darkgray"} + M.bg_hl_weak = {"#252525", 235, "darkgray"} + + -- Special highlight backgrounds (cyan/blue tones) + M.bg_hl_special_strong = {"#1a4a5a", 24, "darkblue"} + M.bg_hl_special = {"#0a3a4a", 23, "darkblue"} + M.bg_hl_special_weak = {"#1a3545", 23, "darkblue"} + + -- Alternative special highlight (green tones) + M.bg_hl_special_alt_strong = {"#1a5a2a", 28, "darkgreen"} + M.bg_hl_special_alt = {"#0a4a1a", 22, "darkgreen"} +else + -- Light mode: neutral gray tones + M.bg_hl_strong = {"#dddddd", 17, "white"} + M.bg_hl = {"#eeeeee", 250, "white"} + M.bg_hl_weak = {"#f7f2f2", 250, "white"} + + -- Special highlight backgrounds (cyan/blue tones) + M.bg_hl_special_strong = {"#a3e0ff", 17, "cyan"} + M.bg_hl_special = {"#d4f0ff", 250, "cyan"} + M.bg_hl_special_weak = {"#e0eaff", 250, "cyan"} + + -- Alternative special highlight (green tones) + M.bg_hl_special_alt_strong = {"#74f283", 17, "cyan"} + M.bg_hl_special_alt = {"#bff2cd", 250, "cyan"} +end -- ============================================================================ -- Status Backgrounds (error, success, modified, fail) -- ============================================================================ --- Error backgrounds (red/pink tones) -M.bg_error = {'#ffd7d7', 196, 'white'} -M.bg_error_weak = {'#ffefef', 196, 'white'} - --- Success background (green tone) -M.bg_success = {'#e0ece0', 196, 'white'} - --- Modified background (blue tone) -M.bg_modified = {'#e0e0ec', 196, 'white'} - --- Fail/warning background (red tone) -M.bg_fail = {'#ece0e0', 196, 'white'} +if is_dark then + -- Dark mode: darker tinted backgrounds + M.bg_error = {'#4a2020', 52, 'darkred'} + M.bg_error_weak = {'#3a1a1a', 52, 'darkred'} + M.bg_success = {'#1a3a1a', 22, 'darkgreen'} + M.bg_modified = {'#1a1a3a', 17, 'darkblue'} + M.bg_fail = {'#3a1a1a', 52, 'darkred'} +else + -- Light mode: light tinted backgrounds + M.bg_error = {'#ffd7d7', 196, 'white'} + M.bg_error_weak = {'#ffefef', 196, 'white'} + M.bg_success = {'#e0ece0', 196, 'white'} + M.bg_modified = {'#e0e0ec', 196, 'white'} + M.bg_fail = {'#ece0e0', 196, 'white'} +end -- ============================================================================ -- Foreground Colors (text) -- ============================================================================ --- Main text colors (gray scale, strongest to weakest) -M.fg_stronger = {'#444444', 236, 'darkgrey'} -- Darkest text -M.fg_strong = {'#666666', 236, 'darkgrey'} -- Dark text -M.fg = {'#8c8c8c', 244, 'gray'} -- Normal text (default) -M.fg_weak = {'#9d9d9d', 251, 'gray'} -- Light text (comments, less important) -M.fg_weaker = {'#bbbbbb', 251, 'gray'} -- Lightest text (very subtle) - --- Exception foreground (reddish-brown for errors/exceptions) -M.fg_exception = {'#7c4444', 251, 'gray'} +if is_dark then + -- Dark mode: light text (inverted from light mode) + M.fg_stronger = {'#e0e0e0', 253, 'white'} -- Lightest text + M.fg_strong = {'#c0c0c0', 250, 'white'} -- Light text + M.fg = {'#a0a0a0', 248, 'gray'} -- Normal text (default) + M.fg_weak = {'#808080', 244, 'gray'} -- Dimmer text (comments, less important) + M.fg_weaker = {'#606060', 241, 'darkgray'} -- Dimmest text (very subtle) + M.fg_exception = {'#d08080', 174, 'red'} -- Light reddish for errors/exceptions +else + -- Light mode: dark text on paper + M.fg_stronger = {'#444444', 236, 'darkgrey'} -- Darkest text + M.fg_strong = {'#666666', 236, 'darkgrey'} -- Dark text + M.fg = {'#8c8c8c', 244, 'gray'} -- Normal text (default) + M.fg_weak = {'#9d9d9d', 251, 'gray'} -- Light text (comments, less important) + M.fg_weaker = {'#bbbbbb', 251, 'gray'} -- Lightest text (very subtle) + M.fg_exception = {'#7c4444', 251, 'gray'} -- Reddish-brown for errors/exceptions +end -- ============================================================================ -- Status Foreground Colors (Git/Diff - muted natural tones) -- ============================================================================ --- Git/diff status indicators (used in statusline, signs, etc.) --- These are muted, natural colors for git changes -M.success = {'#89af89', 196, 'white'} -- Success/addition (muted green) -M.modified = {'#8989af', 196, 'white'} -- Modified/change (muted blue) -M.fail = {'#af8989', 196, 'white'} -- Fail/deletion (muted red) +if is_dark then + -- Dark mode: lighter muted tones + M.success = {'#a0d0a0', 114, 'green'} -- Success/addition (muted green) + M.modified = {'#a0a0d0', 110, 'blue'} -- Modified/change (muted blue) + M.fail = {'#d0a0a0', 174, 'red'} -- Fail/deletion (muted red) +else + -- Light mode: natural muted colors + M.success = {'#89af89', 196, 'white'} -- Success/addition (muted green) + M.modified = {'#8989af', 196, 'white'} -- Modified/change (muted blue) + M.fail = {'#af8989', 196, 'white'} -- Fail/deletion (muted red) +end -- ============================================================================ -- Quickfix/Location List Diagnostic Colors (Muted tones like git/diff) -- ============================================================================ --- These are for quickfix/location list only - similar muted tone to git/diff -M.qf_error = {'#af3f3f', 196, 'white'} -- Error (darker muted red for more contrast) -M.qf_warn = {'#af7f5f', 196, 'white'} -- Warning (muted orange) -M.qf_info = {'#5f8faf', 196, 'white'} -- Info (muted blue) -M.qf_hint = {'#5fafaf', 196, 'white'} -- Hint (lighter muted blue) +if is_dark then + -- Dark mode: lighter muted tones + M.qf_error = {'#d07070', 167, 'red'} -- Error (lighter muted red) + M.qf_warn = {'#d0a080', 173, 'yellow'} -- Warning (muted orange) + M.qf_info = {'#80b0d0', 110, 'blue'} -- Info (muted blue) + M.qf_hint = {'#80d0d0', 116, 'cyan'} -- Hint (lighter muted cyan) +else + -- Light mode: darker muted tones + M.qf_error = {'#af3f3f', 196, 'white'} -- Error (darker muted red for more contrast) + M.qf_warn = {'#af7f5f', 196, 'white'} -- Warning (muted orange) + M.qf_info = {'#5f8faf', 196, 'white'} -- Info (muted blue) + M.qf_hint = {'#5fafaf', 196, 'white'} -- Hint (lighter muted blue) +end -- ============================================================================ -- Diagnostic/Alert Colors (Fluorescent/Neon - intentionally jarring) -- ============================================================================ -- These colors are designed to be NOTICED, not blend in with code --- Fluorescent/neon aesthetic similar to bg_hl_special_alt colors --- Think "highlighter marker" - bright, synthetic, stands out on white paper --- Used for: LSP diagnostics, spelling errors, UI alerts, error messages, etc. +-- Fluorescent/neon aesthetic +-- In light mode: bright, synthetic, stands out on white paper ("highlighter marker") +-- In dark mode: slightly toned down but still prominent --- Diagnostic foreground - Fluorescent colors for maximum visibility -M.diag_error = {'#ff0066', 197, 'red'} -- Hot pink-red (screams "error!") -M.diag_warn = {'#ff6600', 202, 'red'} -- Fluorescent orange (warnings) -M.diag_info = {'#00ccff', 45, 'cyan'} -- Bright fluorescent cyan (info - more prominent) -M.diag_hint = {'#66e0ff', 81, 'cyan'} -- Softer fluorescent cyan (hint - less prominent) -M.diag_hint_dark = {'#0099cc', 38, 'cyan'} -- Darker cyan for UI elements (readable on white) - --- Additional severity level for lighter warnings (spelling, etc.) -M.diag_weak = {'#ff9933', 208, 'yellow'} -- Lighter orange (for SpellLocal, SpellRare, etc.) - --- Diagnostic backgrounds - Light tinted versions for highlighting code -M.bg_diag_error = {'#ffe6f0', 224, 'white'} -- Very light pink (for error backgrounds) -M.bg_diag_warn = {'#fff0e6', 223, 'white'} -- Very light orange (for warning backgrounds) -M.bg_diag_info = {'#e6f9ff', 195, 'white'} -- Very light cyan (for info backgrounds) -M.bg_diag_hint = {'#f0fcff', 195, 'white'} -- Very light cyan (for hint backgrounds) - --- Question/prompt color - Fluorescent cyan for prompts -M.question = {'#00ccff', 45, 'cyan'} -- Bright cyan for questions/prompts (same as diag_info) +if is_dark then + -- Dark mode: still bright but not as harsh + M.diag_error = {'#ff4488', 204, 'red'} -- Bright pink-red + M.diag_warn = {'#ff8833', 208, 'yellow'} -- Bright orange + M.diag_info = {'#44ccff', 81, 'cyan'} -- Bright cyan + M.diag_hint = {'#88ddff', 117, 'cyan'} -- Softer cyan + M.diag_hint_dark = {'#44aacc', 74, 'cyan'} -- Medium cyan + M.diag_weak = {'#ffaa66', 215, 'yellow'} -- Lighter orange + + -- Diagnostic backgrounds + M.bg_diag_error = {'#3a1a25', 52, 'darkred'} + M.bg_diag_warn = {'#3a2a1a', 58, 'brown'} + M.bg_diag_info = {'#1a2a3a', 17, 'darkblue'} + M.bg_diag_hint = {'#1a2f3a', 23, 'darkblue'} + + M.question = {'#44ccff', 81, 'cyan'} +else + -- Light mode: fluorescent colors for maximum visibility + M.diag_error = {'#ff0066', 197, 'red'} -- Hot pink-red (screams "error!") + M.diag_warn = {'#ff6600', 202, 'red'} -- Fluorescent orange (warnings) + M.diag_info = {'#00ccff', 45, 'cyan'} -- Bright fluorescent cyan (info) + M.diag_hint = {'#66e0ff', 81, 'cyan'} -- Softer fluorescent cyan (hint) + M.diag_hint_dark = {'#0099cc', 38, 'cyan'} -- Darker cyan for UI elements + M.diag_weak = {'#ff9933', 208, 'yellow'} -- Lighter orange (spelling, etc.) + + -- Diagnostic backgrounds + M.bg_diag_error = {'#ffe6f0', 224, 'white'} + M.bg_diag_warn = {'#fff0e6', 223, 'white'} + M.bg_diag_info = {'#e6f9ff', 195, 'white'} + M.bg_diag_hint = {'#f0fcff', 195, 'white'} + + M.question = {'#00ccff', 45, 'cyan'} +end -- ============================================================================ -- Primary Accent Colors (brownish-red tones) @@ -125,15 +187,19 @@ M.question = {'#00ccff', 45, 'cyan'} -- Bright cyan for questions/promp -- Primary accent: For "base" languages -- Used for: PHP, JavaScript, Python, etc. --- Languages using primary: --- - PHP: always primary (whether standalone or in tags within HTML) --- - JavaScript: always primary (standalone or embedded) --- - Python: always primary --- Note: Both PHP and JS use primary; acceptable since embedded JS in PHP is discouraged -M.primary_stronger = {"#7f4b4b", 236, "black"} -- Darkest accent -M.primary_strong = {"#5a4444", 236, "black"} -- Dark accent -M.primary = {"#6b5555", 244, "gray"} -- Normal accent -M.primary_weak = {"#7c6666", 248, "darkgray"} -- Light accent +if is_dark then + -- Dark mode: lighter brownish-red tones + M.primary_stronger = {"#d0a0a0", 181, "white"} + M.primary_strong = {"#c09090", 181, "white"} + M.primary = {"#b08080", 138, "gray"} + M.primary_weak = {"#a07070", 131, "darkgray"} +else + -- Light mode: darker brownish-red tones + M.primary_stronger = {"#7f4b4b", 236, "black"} + M.primary_strong = {"#5a4444", 236, "black"} + M.primary = {"#6b5555", 244, "gray"} + M.primary_weak = {"#7c6666", 248, "darkgray"} +end -- ============================================================================ -- Language-Specific Color Palettes (for mixed-language contexts) @@ -148,31 +214,49 @@ M.primary_weak = {"#7c6666", 248, "darkgray"} -- Light accent -- - HTML tags: c3 (blue) - everywhere, whether in .html or embedded in PHP -- - CSS rules: c2 (green) - everywhere, whether in .css or