Change KDE ColorSchemes by Shortcuts

I often find myself switching between ColorSchemes depending upon dark/bright places. KWin provides nice Invert plug-in, but it simply inverts every colour. Not feasible to work, particularly while browsing or watching videos. As far as I know there is no shortcut way to change colorschemes. Hence I created a small hack (named it kcss) to do that. Works pretty well overall. Its a small command line program. Here’s how to to use it -

$ kcss list       # list all available color schemes
$ kcss current    # Color scheme currently in use
$ kcss switch <colorschemename>  # change colorscheme

$ kcss toggle     # toggle between Dark and Light colorscheme

For toggle, it reads a small configuration file called .kcss-profilerc. A sample is given below -

[Dark]
ColorScheme=Obsidian Coast

[Light]
ColorScheme=Oxygen

[Default]
Profile=Dark

Creating Shortcut - Since we now have a command line interface to switch colorschemes, we can easily create a custom shortcut from System Settings > Shortcuts & Gestures. Set action parameter as “kdss toggle” and key-sequence of your choice.

Source Code -

KDE Git Scratchpad
Github

Next – Next thing that I would like to add is to switch/toggle Konsole colorscheme and try to fix some problems (if possible) where you have to restart applications to let colorschemes take effect properly. I don’t have in-depth knowledge of KDE, so I’m not sure if its doing anything bad yet. So take backup of configuration files before you use it and let me know about bugs/fixes.

This entry was posted in Planet KDE, Tips & Tricks and tagged , , . Bookmark the permalink.

8 Responses to Change KDE ColorSchemes by Shortcuts

  1. Bob says:

    Good, but how do we compile this?

  2. Clive Noakes says:

    Hi,
    Thanks for a very handy (and unique I think) program. I had ‘newbe’ trouble with git and then cmake – it has never worked for me- but this time I persevered and after installing g++ and lib’something-with-a-5-in-it’, it compiled and ran fine.

    I noticed that from konsole the schemes with spaces in the name needed quotes (fancy that), while quotes in .kcss-profilerc stopped the toggle operation from working.

    Now to try to leap from your excellent starter and develope a ‘choose from list’ app.

    BTW: coincidence or what – my wireless (wicd) connection died ’til reboot but although rare I doubt it’s connected (to kcss!).

    Dell Inspiron 1720 Mint Kubuntu KDE 4.8.1.

    Cheers

  3. Moviuro says:

    Hi!

    I just found this article as I too was looking for a way to easily change color theme in KDE. Thanks, it helped me alot!

    I’ll upload a Bespin theme + 2 color schemes + instructions to switch colors on KDE-look.org very soon and I’d like to upload your very kcss program: may I?
    If yes, then please tell me which license to use, else, may I link the theme to your post?

    Thanks :)
    Cheers, Moviuro

  4. Pingback: KDEFamily - PrzeglÄ…d prasy 2/2012

  5. Heiko Tietze says:

    That’s what I was looking for since years. Wouldn’t it be a good idea to “enhance” the small tool as plasmoid and publish it officially?
    Thanks a lot, Vishesh!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>