themes.rst 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. .. versionadded:: 0.38.0
  39. You can have kitty automatically change its color theme when the OS switches
  40. between dark, light and no-preference modes. In order to do this, run the theme
  41. kitten as normal and at the final screen select the option to save your chosen
  42. theme as either light, dark, or no-preference. Repeat until you have chosen
  43. a theme for each of the three modes. Then, once you restart kitty, it will
  44. automatically use your chosen themes depending on the OS color scheme.
  45. This works by creating three files: :file:`dark-theme.auto.conf`,
  46. :file:`light-theme.auto.conf` and :file:`no-preference-theme.auto.conf` in the
  47. kitty config directory. When these files exist, kitty queries the OS for its color scheme
  48. and uses the appropriate file. Note that the colors in these files override all other
  49. colors, even those specified using the :option:`kitty --override` command line flag.
  50. kitty will also automatically change colors when the OS color scheme changes,
  51. for example, during night/day transitions.
  52. When using these colors, you can still dynamically change colors, but the next
  53. time the OS changes its color mode, any dynamics changes will be overridden.
  54. Using your own themes
  55. -----------------------
  56. You can also create your own themes as :file:`.conf` files. Put them in the
  57. :file:`themes` sub-directory of the :ref:`kitty config directory <confloc>`,
  58. usually, :file:`~/.config/kitty/themes`. The kitten will automatically add them
  59. to the list of themes. You can use this to modify the builtin themes, by giving
  60. the conf file the name :file:`Some theme name.conf` to override the builtin
  61. theme of that name. Here, ``Some theme name`` is the actual builtin theme name, not
  62. its file name. Note that after doing so you have to run the kitten and
  63. choose that theme once for your changes to be applied.
  64. Contributing new themes
  65. -------------------------
  66. If you wish to contribute a new theme to the kitty theme repository, start by
  67. going to the `kitty-themes <https://github.com/kovidgoyal/kitty-themes>`__
  68. repository. `Fork it
  69. <https://docs.github.com/en/get-started/quickstart/fork-a-repo>`__, and use the
  70. file :download:`template.conf
  71. <https://github.com/kovidgoyal/kitty-themes/raw/master/template.conf>` as a
  72. template when creating your theme. Once you are satisfied with how it looks,
  73. `submit a pull request
  74. <https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request>`__
  75. to have your theme merged into the `kitty-themes
  76. <https://github.com/kovidgoyal/kitty-themes>`__ repository, which will make it
  77. available in this kitten automatically.
  78. Changing the theme non-interactively
  79. ---------------------------------------
  80. You can specify the theme name as an argument when invoking the kitten to have
  81. it change to that theme instantly. For example::
  82. kitten themes --reload-in=all Dimmed Monokai
  83. Will change the theme to ``Dimmed Monokai`` in all running kitty instances. See
  84. below for more details on non-interactive operation.
  85. .. include:: ../generated/cli-kitten-themes.rst