themes.rst 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. Changing kitty colors
  2. ========================
  3. .. only:: man
  4. Overview
  5. --------------
  6. The themes kitten allows you to easily change color themes, from a collection of
  7. over three hundred pre-built themes available at `kitty-themes
  8. <https://github.com/kovidgoyal/kitty-themes>`_. To use it, simply run::
  9. kitten themes
  10. .. image:: ../screenshots/themes.png
  11. :alt: The themes kitten in action
  12. :width: 600
  13. The kitten allows you to pick a theme, with live previews of the colors. You can
  14. choose between light and dark themes and search by theme name by just typing a
  15. few characters from the name.
  16. The kitten maintains a list of recently used themes to allow quick switching.
  17. If you want to restore the colors to default, you can do so by choosing the
  18. ``Default`` theme.
  19. .. versionadded:: 0.23.0
  20. The themes kitten
  21. How it works
  22. ----------------
  23. A theme in kitty is just a :file:`.conf` file containing kitty settings.
  24. When you select a theme, the kitten simply copies the :file:`.conf` file
  25. to :file:`~/.config/kitty/current-theme.conf` and adds an include for
  26. :file:`current-theme.conf` to :file:`kitty.conf`. It also comments out any
  27. existing color settings in :file:`kitty.conf` so they do not interfere.
  28. Once that's done, the kitten sends kitty a signal to make it reload its config.
  29. .. note::
  30. If you want to have some color settings in your :file:`kitty.conf` that the
  31. theme kitten does not override, move them into a separate conf file and
  32. ``include`` it into kitty.conf. The include should be placed after the
  33. inclusion of :file:`current-theme.conf` so that the settings in it override
  34. conflicting settings from :file:`current-theme.conf`.
  35. .. _auto_color_scheme:
  36. Change color themes automatically when the OS switches between light and dark
  37. --------------------------------------------------------------------------------
  38. You can have kitty automatically change its color theme when the OS switches
  39. between dark, light and no-preference modes. In order to do this, run the theme
  40. kitten as normal and at the final screen select the option to save your chosen
  41. theme as either light, dark, or no-preference. Repeat until you have chosen
  42. a theme for each of the three modes. Then, once you restart kitty, it will
  43. automatically use your chosen themes depending on the OS color scheme.
  44. This works by creating three files: :file:`dark-theme.auto.conf`,
  45. :file:`light-theme.auto.conf` and :file:`no-preference-theme.auto.conf` in the
  46. kitty config directory. When these files exist, kitty queries the OS for its color scheme
  47. and uses the appropriate file. Note that the colors in these files override all other
  48. colors, even those specified using the :option:`kitty --override` command line flag.
  49. kitty will also automatically change colors when the OS color scheme changes,
  50. for example, during night/day transitions.
  51. When using these colors, you can still dynamically change colors, but the next
  52. time the OS changes its color mode, any dynamics changes will be overridden.
  53. Using your own themes
  54. -----------------------
  55. You can also create your own themes as :file:`.conf` files. Put them in the
  56. :file:`themes` sub-directory of the :ref:`kitty config directory <confloc>`,
  57. usually, :file:`~/.config/kitty/themes`. The kitten will automatically add them
  58. to the list of themes. You can use this to modify the builtin themes, by giving
  59. the conf file the name :file:`Some theme name.conf` to override the builtin
  60. theme of that name. Here, ``Some theme name`` is the actual builtin theme name, not
  61. its file name. Note that after doing so you have to run the kitten and
  62. choose that theme once for your changes to be applied.
  63. Contributing new themes
  64. -------------------------
  65. If you wish to contribute a new theme to the kitty theme repository, start by
  66. going to the `kitty-themes <https://github.com/kovidgoyal/kitty-themes>`__
  67. repository. `Fork it
  68. <https://docs.github.com/en/get-started/quickstart/fork-a-repo>`__, and use the
  69. file :download:`template.conf
  70. <https://github.com/kovidgoyal/kitty-themes/raw/master/template.conf>` as a
  71. template when creating your theme. Once you are satisfied with how it looks,
  72. `submit a pull request
  73. <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request>`__
  74. to have your theme merged into the `kitty-themes
  75. <https://github.com/kovidgoyal/kitty-themes>`__ repository, which will make it
  76. available in this kitten automatically.
  77. Changing the theme non-interactively
  78. ---------------------------------------
  79. You can specify the theme name as an argument when invoking the kitten to have
  80. it change to that theme instantly. For example::
  81. kitten themes --reload-in=all Dimmed Monokai
  82. Will change the theme to ``Dimmed Monokai`` in all running kitty instances. See
  83. below for more details on non-interactive operation.
  84. .. include:: ../generated/cli-kitten-themes.rst