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

Set Accordion title background colour #52

Open
ralfboernemeier opened this issue May 18, 2024 · 5 comments
Open

Set Accordion title background colour #52

ralfboernemeier opened this issue May 18, 2024 · 5 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@ralfboernemeier
Copy link

ralfboernemeier commented May 18, 2024

Hello,

is it possible to change the background of the Accordion title, when it is open, from blue to a self-defined value?
In my opinion, it would be helpful to maintain a colour style throughout the website.

Regards,
Ralf

@ralfboernemeier ralfboernemeier changed the title Set Accordiian title background colour Set Accordian title background colour May 19, 2024
@ralfboernemeier ralfboernemeier changed the title Set Accordian title background colour Set Accordion title background colour May 19, 2024
@twostraws
Copy link
Owner

This isn't something I've investigated, although I agree it'd be a good idea to make uniformly customizable.

@twostraws twostraws added help wanted Extra attention is needed question Further information is requested labels May 21, 2024
@jkaunert
Copy link

I'll gladly work this if its not yet assigned.

@twostraws
Copy link
Owner

@jkaunert Sounds great – please do look into it and see what you find! We have a lot of places where customization would be useful, so it's something we need to look into before coming up with a plan that can be applied uniformly. Thank you!

@jkaunert
Copy link

jkaunert commented Jun 3, 2024

@twostraws I was hacked around with this by injecting a custom css file link - once again hijacking Head.standardHeaders(for page:in context:)- and adding a root override of the bs-variables for the accordion in custom.css like so:
/* Target root and override Bootstrap CSS Variable defaults */ :root { --bs-accordion-active-bg: #880808; --bs-accordion-active-color: var(--bs-white); }
and it worked nicely.

You can also use pseudoclasses, but its admittedly much more ugly, and you have to reach down into the svg, etc...

/* Use pseudoclasses and target css*/ .accordion-button:not(.collapsed) { color: #FFF !important; background-color: #880808 !important; } .accordion-button::after { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23FFFFFF'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); } .accordion-button:not(.collapsed)::after { background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23FFFFFF'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e"); transform: rotate(180deg); }

maybe turning the Bootstrap css variables into "modifiers" could be a clean, viable option to open up uniform customization...

@twostraws
Copy link
Owner

I think the long-term fix here might be to look into some kind of theming system that controls all these properties in a clean, type-safe way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants