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

Applying color via CSS (and gradients?) #51

Open
danielthedifficult opened this issue Apr 13, 2020 · 2 comments
Open

Applying color via CSS (and gradients?) #51

danielthedifficult opened this issue Apr 13, 2020 · 2 comments

Comments

@danielthedifficult
Copy link

Hello Colin, and thank you so much for this beautiful product!

I am trying to style the button via css, but I can't seem to get it to work. It defaults to green (per line 244 of the .js file).

I've tried:

applause-button { color: red; }

applause-button { color: red !important; }

applause-button .style-root { color: red; }

I apologize if this is something really simple I should be able to figure out from your examples and sample code, but it's not clear to me how to apply it.

My 'real' goal would be to be able to apply a linear gradient effect, and animate it so the button pulses during a moment where we are 'introducing' the feature to the users.

Thank you for any help you can provide regarding changing the color via CSS and/or applying a gradient.

@danielthedifficult
Copy link
Author

Update:

applause-button .style-root { color: red !important; }
does seem to work - but this is not ideal... if I want to change this later by adding another CSS class, it breaks...

@chriswilty
Copy link
Collaborator

chriswilty commented Sep 23, 2024

The standard way of setting color is via the color attribute:

<applause-button color="purple"></applause-button>

From release 4.0.0 you will additionally be able to set CSS property --main-color, though this should only be necessary if you don't have programmatic access to the component.

Note that CSS gradients can only be used where an image would otherwise be specified, which is why they work for backgrounds but not e.g. border color.

Additionally, be wary of using animations and/or colour changes to "introduce" a feature, as then you may be excluding people with visual impairments. The component has better accessibility from release 4.0.0.

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

No branches or pull requests

2 participants