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

how to add WHITE to SUI.COLORS #775

Closed
Maxhodges opened this issue Oct 31, 2016 · 12 comments
Closed

how to add WHITE to SUI.COLORS #775

Maxhodges opened this issue Oct 31, 2016 · 12 comments
Labels

Comments

@Maxhodges
Copy link

I'm having trouble understanding where SUI.COLORS is defined. I need to add WHITE to it. Can someone point me in the right direction?

@layershifter
Copy link
Member

COLORS are defined in SUI.js, they are list of colors from SUI. There are no white color in SUI pallete as you can see.

If you need white class to component, use className:

<Button className='white' />

@Maxhodges
Copy link
Author

OK thanks. I guess we'll just extend SUI.COLORS with a wrapper

@Maxhodges
Copy link
Author

Maxhodges commented Oct 31, 2016

or redefine a color we don't use in the variables
@brown: #FFFFFF ;)

@levithomason
Copy link
Member

@Maxhodges if you have a valid use case for adding white as a color, it would be great to have it added to the CSS over at Semantic-UI. This way, we then generate the proper markup for it.

@Maxhodges
Copy link
Author

We created a dark theme in Semantic-UI for our web app, so of course, we need white and light greys for text on dark backgrounds. It hasn't been a problem because we just override some variables in the theme, but in the case of dropdown the default theme relies on !important like crazy. So I was having trouble overriding them, but I guess I'll just have to use !important too and be more specific with my CSS overrides.

These are the classes on dropdown from http://react.semantic-ui.com/modules/dropdown

I didn't expect SUI to have done it that way, so I thought it was something you guys had done!

Brown is the new white works well enough for me!

image

BTW I love the search field in the docu TOC. Hope @jlukic implements that in the official docs!
image

@Maxhodges
Copy link
Author

I thought more about this, shouldn't you guys be including @primarycolor and @secondaryColor? Then one could easily add white and black to the color scheme

https://github.com/Semantic-Org/Semantic-UI/search?utf8=%E2%9C%93&q=primaryColor&type=Code

@Maxhodges Maxhodges reopened this Nov 2, 2016
@levithomason
Copy link
Member

@primaryColor and @secondaryColor are LESS variables that must be compiled to CSS. Semantic-UI-React only concerns itself with React components that generate valid Semantic-UI markup. There is no HTML nor CSS code in this project.

Due to my own interest in supporting styling, and the overwhelming community interest, it is definitely on my radar to add some kind of support that makes sense in the React paradigm. This will be a long way off though.

@levithomason
Copy link
Member

Another way to look at this is, if we included any LESS variables, we'd also have to include the entire gulp powered Semantic-UI theming build system. Otherwise, there is no way to translate those variables into CSS.

@Maxhodges
Copy link
Author

Maxhodges commented Nov 2, 2016

UI-React only concerns itself with React components that generate valid Semantic-UI markup. There is no HTML nor CSS code in this project.

hum, but you have an enum of colors for teal, pink, blue and green, etc. So I'm just suggesting to add primaryColor and secondaryColor to that enum. SUI already has these variables defined for brand colors but you've not exposing them for us, right?

see my link. the @primarycolor already exists in SUI

@levithomason
Copy link
Member

Those colors are html classNames. All props are nothing more than a translation to classNames and markup:

<Button color='green' />

Renders:

<button class="ui green button"></button>

The links you provided are links to LESS stylesheets. There is no styling involved in this repo.

I realize you might be asking, "How do I create a primary/secondary button?". If so:

<Button primary />
<Button secondary />

See the docs here: http://react.semantic-ui.com/elements/button#emphasis

@Maxhodges
Copy link
Author

Ok I see. I was thinking if primaryColor was exposed in the SUI.COLORS enum then we could use it to create custom ui header colors too, for example. But yeah I guess a bit more thought should go into it. until then I can only redefine existing colors if I want to introduce a white and black.

I created a new dark theme and redefined the header default color to be white so it will appear on black. But now I also need black so I can display black headers on our white background homepage...

but at least I have this workaround

/*******************************
     User Global Variables
*******************************/

@brown: #FFFFFF; //brown is the new white
@olive: #000000; //olive is the new black

just thought it would be nice if SUI.COLOR included a few extras like @brandColor1, @brandColor2, etc. I guess that's up to @jlukic ?

@levithomason
Copy link
Member

The SUI enums are 1:1 mappings to Semantic-UI classNames. So, any proposed additions there should be proposed as additions to Semantic-UI markup and CSS.

If you'd like to add your own styles on top of SUI, I'd suggest just using className directly. So, if you added a white header:

your-custom-override-theme.css

.ui.header.white {
  /* rules */
}

Then, in your app:

<Header className='white' />

This will render this HTML:

<div class="ui header white"></div>

That way, you are extending the base theme with your own classes and associated styles. It also prevents you from having the confusing color='brown' render a white header, etc.

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

No branches or pull requests

3 participants