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

[Feature Request] recommended text-color css helper #4921

Closed
kpilard opened this issue Aug 20, 2018 · 6 comments
Closed

[Feature Request] recommended text-color css helper #4921

kpilard opened this issue Aug 20, 2018 · 6 comments
Assignees
Labels
Milestone

Comments

@kpilard
Copy link

kpilard commented Aug 20, 2018

Can you add a way to automatically set the text color of fields. It can be pretty annoying to create a colored component and look for the recommended text-color.
If you render a dynamic colored component you always need some logic to add the correct text-color.

I could add the feature if it is needed.

Here is in exmple of the problem and a way to implement is just with css.
https://codepen.io/anon/pen/MBPLKE

@kpilard kpilard changed the title Text-Color css helper recommended text-color css helper Aug 20, 2018
@KaelWD
Copy link
Member

KaelWD commented Aug 20, 2018

https://github.com/vuetifyjs/vuetify/pull/2872/commits/414cfe1d52f9cb8d45009cbc844efb71e72a299b

@kpilard
Copy link
Author

kpilard commented Aug 20, 2018

@KaelWD Okay in this case the colors were calculated with some sort of algorithm, right?
I would just add a mapping of colors to recommended text-colors.
Of course it could be that it is too much css is for too little functionality.

Example of light blue

default should be white
lighten-5 to lighten-1 should be black
darken-1 to darken-4 should be white
accent should be black
example

@KaelWD
Copy link
Member

KaelWD commented Aug 20, 2018

Yes, that was originally just for theme colours (primary etc). This is something I want to revisit at some point though.

@johnleider johnleider added the T: feature A new feature label Sep 15, 2018
@johnleider johnleider added this to the v2.0.0 milestone Sep 15, 2018
@MajesticPotatoe MajesticPotatoe changed the title recommended text-color css helper [Feature Request] recommended text-color css helper Dec 7, 2018
@johnleider johnleider removed this from the v2.0.0 milestone Jun 11, 2019
@erichorne
Copy link

For custom colors there is a similar situation. There are times when the light/dark versions of custom colors come too close to the text-color associated with the light/dark theme. Imagine a dark color of white and a light color of black. In this case, when the light theme is used, the text color will not be visible. Same if the dark theme is used.

Adding the ability to associate a text color to the custom color (or, more generally, associate a css class) would provide developers access to more appropriately set the text color to match the background. Alternatively, determining the text-color based on the light-ness or dark-ness of the background color would also work.

What started me on this was trying to get a custom color to work like the built-in color 'primary' for v-btn -- in a light theme with default theme, the text color is white--text, not black--text.

Without this feature, it is possible for theme colors to unintentionally make text difficult to read.

See https://codepen.io/erichorne/pen/MWgyYge for an example.

@Serhansolo

This comment has been minimized.

@KaelWD KaelWD added this to the v3.0.0 milestone Oct 7, 2020
@johnleider johnleider added this to To do in Vuetify 3 - Titan via automation Nov 30, 2020
@johnleider johnleider removed this from To do in Vuetify 3 - Titan Dec 3, 2020
@johnleider
Copy link
Member

This is happening in version 3 with the updated theme system and automatic contrast detection. Follow for future updates #12688.

If you have any additional questions, please reach out to us in our Discord community.

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

6 participants