Skip to content

A Plugin to set timeframes for different themes in neovim

Notifications You must be signed in to change notification settings

luxus/colorful-times-nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Colorful Times

A Neovim plugin that automatically changes your colorscheme based on a schedule, system settings, or manually. Generated by OpenAI o1, colorful-times allows for a dynamic and personalized editing experience. CI

Features

  • Scheduled Colorscheme Changes: Define time slots with specific colorschemes and backgrounds.
  • System Background Detection: Automatically adjust the background based on your system's light/dark mode.
  • Custom System Background Detection on Linux: Specify a custom command or function to detect the system background.
  • Configurable Refresh Time: Set how often the plugin checks for system background changes.
  • Manual Toggle and Reload: Easily enable/disable the plugin or reload the configuration without restarting Neovim.
  • User Commands: Control the plugin with :ColorfulTimesToggle and :ColorfulTimesReload.
  • Notifications: Receive feedback when the plugin is toggled or reloaded.

Installation

Use your preferred plugin manager to install colorful-times. For example, with lazy.nvim:

    return {
      "luxus/colorful-times-nvim",
      enabled = true,
      lazy = false, -- Load the plugin immediately
      opts = {
        default = {
          colorscheme = "default",
          background = "system",
        },
        schedule = {
          { start = "04:50", stop = "17:00", colorscheme = "night-owl" },
          { start = "17:00", stop = "18:00", colorscheme = "default" },
        },
        refresh_time = 5000, -- Refresh time in milliseconds
      },
    }

Options

  • schedule (array): List of schedule entries with start, stop, colorscheme, and optional background.
  • default (table): Default colorscheme and background when no schedule matches.
  • enabled (boolean): Whether the plugin is enabled on startup.
  • refresh_time (integer): How often (in milliseconds) to check for system background changes.
  • system_background_detection (string|function|nil): Custom command or function to detect the system background on Linux.

Schedule Entry

Each schedule entry should have:

  • start (string): Start time in "HH:MM" format.
  • stop (string): Stop time in "HH:MM" format.
  • colorscheme (string): Name of the colorscheme to apply.
  • background (string|nil): "light", "dark", "system", or nil to use the default background.

Usage

Commands

  • :ColorfulTimesToggle: Toggle the plugin on or off.
  • :ColorfulTimesReload: Reload the plugin configuration.

Functions

If you prefer, you can control the plugin programmatically:

    require('colorful-times').toggle()
    require('colorful-times').reload()

Notes

  • System Background Detection on macOS:
    • The plugin uses the defaults command to detect light/dark mode.
  • Custom System Background Detection on Linux:
    • Provide a custom command or function via system_background_detection to detect the system background.
    • If not set and 'system' is used as the background, the plugin falls back to the default background or leaves it unchanged.
  • Colorscheme Availability:
    • Ensure that the colorschemes specified in your schedule are installed and accessible in Neovim.

License

This plugin is licensed under the MIT License.

About

A Plugin to set timeframes for different themes in neovim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published