Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: Import KDE/Plasma Color Scheme Files #54

Closed
AndydeCleyre opened this issue Jan 9, 2017 · 17 comments
Closed

Request: Import KDE/Plasma Color Scheme Files #54

AndydeCleyre opened this issue Jan 9, 2017 · 17 comments

Comments

@AndydeCleyre
Copy link

KDE / Plasma color schemes are INI-style files that list UI component colors as RGB values. For example a .colors file includes a section like this:

[Colors:Window]
BackgroundAlternate=57,64,70
BackgroundNormal=50,56,62
DecorationFocus=206,57,52
DecorationHover=206,57,52
ForegroundActive=240,156,150
ForegroundInactive=118,130,143
ForegroundLink=216,89,79
ForegroundNegative=236,82,82
ForegroundNeutral=201,112,22
ForegroundNormal=174,181,188
ForegroundPositive=93,168,19
ForegroundVisited=163,90,237

My request is for Oomox to be able to import one of these .colors files, pick out the ~12 colors Oomox cares about, convert the values to hex format, and create a new preset with those values.

Here is a reasonable mapping for those significant color slots:

Oomox KDE
Background [Colors:Window][BackgroundNormal]
Foreground/text [Colors:Window][ForegroundNormal]
Menu/toolbar background [Colors:View][BackgroundNormal]
Menu/toolbar text [Colors:View][ForegroundNormal]
Selection highlight [Colors:Selection][BackgroundNormal]
Selection text [Colors:Selection][ForegroundNormal]
Textbox background [Colors:View][BackgroundNormal]
Textbox text [Colors:View][ForegroundNormal]
Button background [Colors:Button][BackgroundNormal]
Button text [Colors:Button][ForegroundNormal]
Header button background [Colors:Button][BackgroundNormal]
Header button text [Colors:Button][BackgroundNormal]

Also useful is that the name of the scheme can be found at [General][Name].

@actionless
Copy link
Member

is there still interest on this?

@AndydeCleyre
Copy link
Author

Yes

@actionless
Copy link
Member

and do you have any example files?

@AndydeCleyre
Copy link
Author

@actionless
Copy link
Member

also currently themix have more options, could you please write translation table for newer themix options? (wm window border color for example)

@actionless
Copy link
Member

or you can just put this file inside oomox repo dir and run it with specifying path to KDE theme as first argument:

python3 ./kde_colors.py ./path/to/kde.colors
from configparser import ConfigParser

from oomox_gui.plugin_api import OomoxImportPlugin
from oomox_gui.color import color_hex_from_list


class KDEColors(ConfigParser):  # pylint: disable=too-many-ancestors

    def __init__(self, colors_path):
        super().__init__()
        self.read(colors_path)

    def get_color(self, section, key):
        r, g, b = self.get(section, key).split(',')
        return color_hex_from_list([r, g, b])


class Plugin(OomoxImportPlugin):

    name = 'kde_colors'
    display_name = 'Import KDE .colors file'

    theme_translation = dict(
        BG=('Colors:Window', 'BackgroundNormal', ),
    )

    def read_colorscheme_from_path(self, preset_path):
        kde_colors = KDEColors(preset_path)
        themix_theme = {}
        for themix_key, kde_path in self.theme_translation.items():
            themix_theme[themix_key] = kde_colors.get_color(*kde_path)
        return themix_theme


if __name__ == '__main__':
    import sys

    print(Plugin().read_colorscheme_from_path(sys.argv[1]))

@actionless
Copy link
Member

and, if it works for you, could you please replace the code block

    theme_translation = dict(
        BG=('Colors:Window', 'BackgroundNormal', ),
    )

to an actual theme mapping?

@AndydeCleyre
Copy link
Author

I can write a full translation table if you provide a list or screenshot of the colors handled by themix. I cannot install themix via the AUR oomox-git package, because a dependency, resvg-git, fails to compile.

@actionless
Copy link
Member

actionless commented Jan 22, 2019

{
 "THEME_STYLE": "Theme Style",
 "BG": "Background",
 "FG": "Text",
 "HDR_BG": "Header Background",
 "HDR_FG": "Header Text",
 "SEL_BG": "Selected Backround",
 "SEL_FG": "Selected Text",
 "ACCENT_BG": "Accent Color (Checkboxes, Radios)",
 "TXT_BG": "Textbox Background",
 "TXT_FG": "Textbox Text",
 "BTN_BG": "Button Background",
 "BTN_FG": "Button Text",
 "HDR_BTN_BG": "Header Button Background",
 "HDR_BTN_FG": "Header Button Text",
 "WM_BORDER_FOCUS": "Focused Window Border",
 "WM_BORDER_UNFOCUS": "Unfocused Window Border",
 "MATERIA_VIEW": "View",
 "MATERIA_SURFACE": "Surface (like Button, Menu, Popover)",
 "ARC_WIDGET_BORDER_COLOR": "Border",
 "CARET1_FG": "Textbox Caret",
 "CARET2_FG": "BiDi Textbox Caret",

 "ROUNDNESS": "Roundness",
 "GRADIENT": "Gradient",
 "CARET_SIZE": "Textbox Caret Aspect Ratio",
 "SPACING": "Spacing",
 "OUTLINE_WIDTH": "Focused Outline Width",
 "BTN_OUTLINE_WIDTH": "Focused Button Outline Width",
 "BTN_OUTLINE_OFFSET": "Focused Button Outline Offset",
 "GTK3_GENERATE_DARK": "Add Dark Variant",
 "CINNAMON_OPACITY": "Cinnamon: Opacity",
 "MATERIA_SELECTION_OPACITY": "Selection Opacity",
 "MATERIA_PANEL_OPACITY": "DE Panel Opacity",
 "MATERIA_STYLE_COMPACT": "Compact Style",
 "ARC_TRANSPARENCY": "Enable Theme Transparency",
 "UNITY_DEFAULT_LAUNCHER_STYLE": "Unity: Use Default Launcher Style",

 "ICONS_STYLE": "Icons Style",
 "ICONS_LIGHT_FOLDER": "Light Base (Folders)",
 "ICONS_MEDIUM": "Medium Base",
 "ICONS_DARK": "Dark Stroke",
 "ICONS_LIGHT": "Light Base",
 "ICONS_ARCHDROID": "Icons Color",
 "ICONS_SYMBOLIC_ACTION": "Actions Icons",
 "ICONS_SYMBOLIC_PANEL": "Panel Icons",
 "ICONS_NUMIX_STYLE": "Numix Style",

 "TERMINAL_THEME_MODE": "Theme Options",
 "TERMINAL_BASE_TEMPLATE": "Theme Style",
 "TERMINAL_BACKGROUND": "Background",
 "TERMINAL_FOREGROUND": "Foreground",
 "TERMINAL_ACCENT_COLOR": "Accent Color",
 "TERMINAL_THEME_AUTO_BGFG": "Auto-Swap BG/FG",
 "TERMINAL_THEME_EXTEND_PALETTE": "Extend Palette with More Lighter/Darker Colors",
 "TERMINAL_THEME_ACCURACY": "Palette Generation Accuracy",
 "TERMINAL_COLOR0": "Black",
 "TERMINAL_COLOR8": "Black Highlight",
 "TERMINAL_COLOR1": "Red",
 "TERMINAL_COLOR9": "Red Highlight",
 "TERMINAL_COLOR2": "Green",
 "TERMINAL_COLOR10": "Green Highlight",
 "TERMINAL_COLOR3": "Yellow",
 "TERMINAL_COLOR11": "Yellow Highlight",
 "TERMINAL_COLOR4": "Blue",
 "TERMINAL_COLOR12": "Blue Highlight",
 "TERMINAL_COLOR5": "Purple",
 "TERMINAL_COLOR13": "Purple Highlight",
 "TERMINAL_COLOR6": "Cyan",
 "TERMINAL_COLOR14": "Cyan Highlight",
 "TERMINAL_COLOR7": "White",
 "TERMINAL_COLOR15": "White Highlight",

 "SPOTIFY_PROTO_BG": "Background",
 "SPOTIFY_PROTO_FG": "Foreground",
 "SPOTIFY_PROTO_SEL": "Accent Color"
}
  1. workaround: remove rust, install rustup, rustup toolchain install 1.32.0, rustup default 1.32.0

@AndydeCleyre
Copy link
Author

I don't know what all the named values really correspond to (like why do materia and arc use different colors than every other theme?). I'll take a look at the program if and when there's a working PKGBUILD.

@actionless
Copy link
Member

actionless commented Jan 24, 2019

man, what's wrong with you, read my message above carefully:

PKGBUILD is fine, LLVM is broken in arch, so do rust, install rust directly

@AndydeCleyre
Copy link
Author

what's wrong with you

Yeesh. Good luck with your project.

@actionless
Copy link
Member

you didn't cared to read properly my reply and started blaming me in incorrect pkgbuild and now also playing drama. problem not on my side

@actionless
Copy link
Member

actionless commented Feb 17, 2019

arch linux pushed fixed version of their official rust package to stable repo today, so resvg can be built successfully without preconfiguring rustup manually:

Name            : rust
Version         : 1:1.32.0-2
Description     : Systems programming language focused on safety, speed and concurrency
Architecture    : x86_64
URL             : https://www.rust-lang.org/
Licenses        : MIT  Apache
Groups          : None
Provides        : cargo  rustfmt
Depends On      : gcc-libs  llvm-libs  curl  libssh2
Optional Deps   : None
Conflicts With  : cargo  rustfmt
Replaces        : cargo  rustfmt
Download Size   : 62.33 MiB
Installed Size  : 192.62 MiB
Packager        : Johannes Löthberg <[email protected]>
Build Date      : Sun 17 Feb 2019 11:47:14 AM CET
Validated By    : MD5 Sum  SHA-256 Sum  Signature

@gusbemacbe
Copy link
Contributor

gusbemacbe commented Feb 24, 2019

@actionless

also more about conversion between KDE and oomox palettes here, i need some help from KDE user to finish the plugin:

Maybe you can get some help from KDE users that know better about KDE than me:

@elenapan: I am not sure if she makes KDE themes, but she made, modified and readapted totally incredible themes which became a big success in the subreddit r/unixporn. You can see her works: https://github.com/elenapan/dotfiles.
@EliverLara: he is a guru of GNOME and KDE. His works are a succes in the subreddit r/unixporn. His works: https://github.com/EliverLara/Sweet
@L4ki: he knows better about KDE Plasma colorschemes and also about KDE Plasma themes. He did more than 20 themes and colorschemes.
@mcder3: another KDE guru, he knows better about Plasma theme. His KDE Plasma "Helium" is a success.
@pwyde: He is no longer in GitHub, now he merged to GitLab. He is reponsible for making the whole "Look and Feel" theme, he is also another guru. He also develops Kvantum and understands how works the transparency in the Dolphin file manager. At his GitLab: https://gitlab.com/pwyde.

@gusbemacbe
Copy link
Contributor

gusbemacbe commented Feb 24, 2019

@actionless,

I converted gtk2 to qt5ct, Dolphin got ugly due to missed colours (all black) and also there are missed colours of window decoration (black), and the Plasma theme (menubar) did not get the 90s summer either.

imagem

It is why better these KDE users indicated above help you to fix.

@actionless
Copy link
Member

i've added the initial version of the template, but it needs a lot of extra values to be added: https://github.com/themix-project/themix-plugin-base16/blob/master/templates_extra/kde/templates/default.mustache

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants