8000 Default themes by davidlatwe · Pull Request #111 · mottosso/allzpark · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Default themes #111

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

Merged
merged 18 commits into from
Nov 2, 2020
Merged

Default themes #111

merged 18 commits into from
Nov 2, 2020

Conversation

davidlatwe
Copy link
Collaborator
@davidlatwe davidlatwe commented Oct 19, 2020

This PR

Here's the result :

Outdated info, see comments below

4148c551-f606-41c8-b1ff-c7a1162d40ff

Custom Theme With Palettes

The style.css has been changed to be able to format with color codes by keywords, e.g.

QPushButton {
    border: 1px solid %(dim)s;
    background: %(brightest)s;
}

And multiple color codes can be provided from an attribute named palettes in user's allzparkconfig.py, like this :

# allzparkconfig.py
palettes = {
    # These will be picked up in preference
    "another_dark_theme": {
        "brightest": "#403E3D",
        "bright": "#383635",
        "base": "#2E2C2C",
        "dim": "#21201F",
        "dimmest": "#141413",

        "highlight": "#69D6C2",
        "highlighted": "#111111",
        "active": "silver",
        "inactive": "dimGray",
    },
}

Next Step

  • Add palette editor next to the current CSS editor, so user can spin the color wheels in there to test the theme in live action. Once done, press a button to save the palette in a .json file next to the preference .ini file.

  • Load style-sheet from allzparkconfig.py. This will ignore the default style.css completely, so the theme palettes in preference will be disabled.

@mottosso
Copy link
Owner
8000 mottosso commented Oct 20, 2020

You are a star. :) Very nicely done @davidlatwe.

I really like the new code font.

My one critique would be the shade of that light theme.

Before After

I personally would prefer the "Before", as the new light seems a bit.. dull?

My next critique would be the button shape/shading.

Before image
After image

They lost the outline, which I think helps distinguish them from the background and justifies that empty space between the buttons a little better.

The same applies to the dock title bar, in both light and dark themes.

Before image
After image

I think I'm generally in favour of a more "3d" look than the more "modern" flat look, what do you think?

@davidlatwe
Copy link
Collaborator Author

Thanks @mottosso ! So here's the a bit improved.

I guess the ..dull feel on light theme, might be because the background is much grayer and a bit yellowish then the original. So I have bump up a little bit. (can't bump it too white, need to leave some space for brighter color making contrast)

From left to right : original -> previous -> latest

image

And here's the quick view of new header buttons being toggled, and the improved dock title (I guess that's the 3d what you were saying ? dark border + little margin)

image

@BigRoy
Copy link
Collaborator
BigRoy commented Oct 20, 2020

I still feel we could push further to the color scheme of the original. That "dim grey" just looks like my brightness of my screen is off a bit. It's already much better but still slightly has that old-school feeling.

(can't bump it too white, need to leave some space for brighter color making contrast)

Is this really crucial to the theme? To me the layout seemed readable in the original too, even cleaner than the new "dim grey" latest version.

@mottosso
Copy link
Owner

I guess that's the 3d what you were saying ? dark border + little margin

Yep! That's it. I like it much better, what do you think?

can't bump it too white, need to leave some space for brighter color making contrast

I'm with Roy, I would prefer we keep it full white like in the current version, and leave any darkening to the dark theme.

@davidlatwe
Copy link
Collaborator Author
davidlatwe commented Oct 20, 2020

Here it is ! Brightest theme 🚀

current master branch <-> latest light theme

image

Yep! That's it. I like it much better, what do you think?

I like the new dock title as well. :D

Is this really crucial to the theme?

Well, kind of. Or should say this is the exact down side of using one template style-sheet to compose all styles I think.

Since in order to keep the color keywords as few as possible, and keeping push-buttons or combo-box to be separated from the background at the same time, it became like a mono tone styling when making dark/light theme.

And changing the template itself means other color styles would be affected as well. Especially for dark/light theme since their color gradient direction must be reversed to each other, and a template could have only one setup. So they may not easily coexists in the same template and works for all.

Should have thought about this. :(
But, after I adding one more keyword %(prim)s, the problem seems being eased. :D

Still, let me know what you think about this new light theme !

P.S. nice to see you here @BigRoy 👋🏼

@mottosso
Copy link
Owner

I like it, but if I was picky then there's just a few more things that stand out to me.

Outline 1

image

  1. Is missing an outline
  2. Is missing a fill

I think these are important to highlight that they are clickable. In case of the Launch button, also helps pull the eye in that direction, and ground the interface towards its most important aspect; actually launching something.

Outline 2

This outline is too bright/strong, demands too much attention. Could we make it either disappear, or the same color as the outline of the tabs?

Color

image

Could we keep the original blue for highlights? I dunno, that turquoise makes me thing there's something wrong with the color balance of my display, but I understand this is rather subjective! :D

But, after I adding one more keyword %(prim)s, the problem seems being eased. :D

I've been down this road as well and know what you mean. Have you considered letting the user add not just color, but full qlinear() statements to the theme? That should sort out these outliers, and also enable some flashy gradients to get added hehe.

@davidlatwe
Copy link
Collaborator Author

Improvement & fix :

image

Refactored

  • Separate light/dark themes into two different stylesheet .css files.
  • Console log level colors customizable.
  • allzparkconfig.palettes changes to allzparkconfig.themes(), this also enables loading multiple custom stylesheets, not just colors (palettes).

Implementation of custom themes loading

Theme stylesheet parsing and selecting logic is implemented in resources.py. Following is the entry for user to setup their custom themes in allzparkconfig.py :

# allzparkconfig.py

def themes():
    """Allzpark GUI theme list provider

    This will only be called once on startup.

    Each theme in list is a dict object, for example:

    {
        "name": "theme_name",
        "source": "my_style.css",
        "keywords": {"base-tone": "red", "res": "path-to-icons"},
    }

    * `name` is the theme name, this is required.
    * `source` can be a file path or plain css code, this is required.
    * `keywords` is optional, must be dict type if provided, will be
        used to string format the css code.

    Returns:
        list

    """
    return []

And in "Preference" page, in "Appearance" (previously "Theme") section have a drop-down list for user to select and change between all current loaded themes from allzparkconfig.py.

The keywords of current active theme will be used to format stylesheet code from CSS editor as well.

This should be enough to close #82.

@davidlatwe
Copy link
Collaborator Author
davidlatwe commented Oct 21, 2020

Ouch, forgot to mention that in commit 5569df7, I updated qargparse.py solely here without making a PR in mottosso/qargparse.py first. I'll make one later.

The reason for that change was because the Preferences.options (list of QArgument widgets) are being defined outside of __init__, and themes were not loaded at the time that class is being imported.

  1. startup
  2. importing modules, widget classes
  3. load themes
  4. create widgets

To workaround that, I need the function resources.theme_names() which responsible to provide theme list to preference option widget, to return them lazily (on Preference.__init__()).

But qargparse.Enum (the widget type for listing themes) was not support getting items from generator at the time being, so I made the change here for convenience.

@davidlatwe
Copy link
Collaborator Author
davidlatwe commented Oct 21, 2020

Changing custom theme (Avalon style) in live action !

# allzparkconfig.py
def themes():
    from avalon import style
    return [
        {
            "name": "avalon",
            "source": style.load_stylesheet(),
        }
    ]

bf4dcc5b-7b6b-4950-8b53-05b25304eba5

@davidlatwe davidlatwe marked this pull request as ready for review October 21, 2020 14:14
@davidlatwe
Copy link
Collaborator Author

Merging this today :)

@davidlatwe davidlatwe merged commit 0a3e964 into mottosso:master Nov 2, 2020
@davidlatwe davidlatwe deleted the default-themes branch November 2, 2020 16:12
This was referenced Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

QTextEdit not rendering $nbsp correctly with Windows' default font face
3 participants
0