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

[Colors] Central dynamic color map for every component #261

Merged
merged 43 commits into from
Dec 21, 2018

Conversation

lubber-de
Copy link
Member

@lubber-de lubber-de commented Nov 26, 2018

Description

This PR provides the base to create a central dynamic color palette in a single mixin-map instead of hardcoding every possible color in each component.
To stay backward compatible, this map currently holds the already existing global color variables.

Now it's possible to define only the colors and naming you want and each component will generate the appropriate component with the colors and those namings which are defined in the central map.

This way it's now easy to define completely new color-names without touching any component manually.

Example

If somebody does not like the basic FUI color palette but want to use only brand color namings instead, the colors.less needs to be created in the appropriate {site} folder of the theme folder having this example content:

// those variables should be defined in your site.variables  
@pinkie       : #ED458B;
@lightPinkie  : #f9b8d2;
@pinkieText   : #EB81B4;
@twilight     : #8689c8;
@lightTwilight: #d19fe3;
@twilightText : #662d8a;

@colors: {
  @pinkiepie: {
    color          : @pinkie;
    light          : @lightPinkie;
    border         : #BE1D77; 
    background     : @lightPinkie;
    header         : @pinkie;
    boxShadow      : none;
    boxFloatShadow : none;
    text           : @pinkieText;   
    lightText      : @pinkieText;   
    hoverText      : @pinkieText;                              
    focus          : @pinkieText; 
    lightFocus     : @pinkieText; 
    down           : @pinkieText; 
    lightDown      : @pinkieText; 
    active         : @pinkieText; 
    lightActive     : @pinkieText; 
    shadow         : @pinkieText; 
    lightShadow     : @pinkieText; 
    hover          : saturate(darken(@pinkie, 5), 10, relative);
    lightHover     : saturate(darken(@lightPinkie, 5), 10, relative);
    ribbon         : darken(@pinkie,10);
    invertedRibbon : darken(@lightPinkie,10);
    isDark         : false;
    isVeryDark     : false;
  };
  @twilight: {
    color          : @twilight;
    light          : @lightTwilight;
    border         : #263773; 
    background     : @lightTwilight;
    header         : @twilight;
    boxShadow      : none;
    boxFloatShadow : none;
    text           : @twilightText;
    lightText      : @twilightText;
    hoverText      : @twilightText;
    focus          : @twilightText; 
    lightFocus     : @twilightText; 
    down           : @twilightText; 
    lightDown      : @twilightText; 
    active         : @twilightText; 
    lightActive     : @twilightText; 
    shadow         : @twilightText; 
    lightShadow     : @twilightText; 
    hover          : saturate(darken(@twilight, 5), 10, relative);
    lightHover     : saturate(darken(@lightTwilight, 5), 10, relative);
    ribbon         : darken(@twilight,10);
    invertedRibbon : darken(@lightTwilight,10);
    isDark         : true;
    isVeryDark     : false;
  };
}

Now only those color names pinkiepie and twilight are available and compiled into the whole framework instead of the FUI default ones. You would be able to use everything like ui pinkiepie button ui twilight segment and so on...

Using this feature requires LESS >= v3.7

Element Status Special
segment ✔️ !important replaced by proper specificity 🙂
label ✔️
slider ✔️
progress ✔️
header ✔️ !important replaced by proper specificity 🙂
toast ✔️
button ✔️ !important replaced by proper specificity 🙂
message ✔️
card ✔️
statistic ✔️
icon ✔️ !important removed (was not needed)
table ✔️ !important removed (was not needed), added cell color support
grid ✔️ !important removed (was not needed)
menu ✔️ !important removed (was not needed)
loader ✔️
text ✔️ New component #289, see below
rating ✔️

Github Tasklist Overview

To be able to see open tasks counter in the Issues Overview

  • segment
  • label
  • slider
  • progress
  • header
  • toast
  • button
  • message
  • card
  • statistic
  • icon
  • table
  • grid
  • menu
  • loader
  • text
  • rating

Screenshots

New Text component limited to span tags as discussed in #289

Tomatoes are <span class="ui red">red</span>

image

Table Cell color support

<td class="orange">September 14, 2013 (disabled)</td>
<td class="purple disabled">September 14, 2013 (disabled)</td>

image

Relates to

Semantic-Org/Semantic-UI#6673
Semantic-Org/Semantic-UI#6661
Semantic-Org/Semantic-UI#6193
Semantic-Org/Semantic-UI#2279
Semantic-Org/Semantic-UI#4650

@lubber-de lubber-de self-assigned this Nov 26, 2018
@lubber-de lubber-de added type/feat Any feature requests or improvements lang/css Anything involving CSS state/awaiting-reviews Pull requests which are waiting for reviews labels Nov 26, 2018
@lubber-de lubber-de changed the title [Colors] Dynamic color maps for every component [Colors] Central dynamic color map for every component Nov 26, 2018
@y0hami y0hami added this to the 2.7.x milestone Nov 27, 2018
@y0hami
Copy link
Member

y0hami commented Nov 27, 2018

I think this is an excellent start and I think you should start moving the other components into this format.

Great work @lubber-de 👍

@lubber-de
Copy link
Member Author

@hammy2899 Thanks 🙂
Would be great, if we could merge the label PR first, so I don't need to touch the current huge label code unnecessarily 😉

prudho
prudho previously approved these changes Nov 28, 2018
Copy link
Contributor

@prudho prudho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @hammy2899, this is a great addition !

@lubber-de lubber-de added the state/awaiting-docs Pull requests which need doc changes/additions label Dec 20, 2018
@lubber-de lubber-de added tag/new-component New UI components and removed state/on-hold Issues and pull requests which are on hold for any reason labels Dec 21, 2018
@lubber-de
Copy link
Member Author

This PR is ready for review now 😊

Copy link
Member

@y0hami y0hami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@ColinFrick ColinFrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@y0hami y0hami merged commit 6e4994d into fomantic:develop Dec 21, 2018
@y0hami y0hami added state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo and removed state/awaiting-reviews Pull requests which are waiting for reviews state/awaiting-docs Pull requests which need doc changes/additions labels Dec 21, 2018
@lubber-de lubber-de deleted the dynamic_color_maps branch December 21, 2018 16:13
This was referenced Dec 21, 2018
@lubber-de lubber-de modified the milestones: 2.7.x, 2.7.0 Dec 28, 2018
@lubber-de
Copy link
Member Author

Docs added by fomantic/Fomantic-UI-Docs#377

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/css Anything involving CSS state/has-docs A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo tag/new-component New UI components type/feat Any feature requests or improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants