Skip to content

Instantly share code, notes, and snippets.

@wplit
Created June 13, 2024 01:17
Show Gist options
  • Save wplit/051aae1ad2816e67d0962e3f69a7f8bb to your computer and use it in GitHub Desktop.
Save wplit/051aae1ad2816e67d0962e3f69a7f8bb to your computer and use it in GitHub Desktop.
change facet button colors based on nth-child
/* colors when unselected */
%root% .wpgb-facet .wpgb-button-facet li:nth-child(1) .wpgb-button {
background-color: red;
border-color: red;
color: white;
}
%root% .wpgb-facet .wpgb-button-facet li:nth-child(2) .wpgb-button {
background-color: red;
border-color: red;
color: white;
}
%root% .wpgb-facet .wpgb-button-facet li:nth-child(3) .wpgb-button {
background-color: red;
border-color: red;
color: white;
}
/* colors when selected */
%root% .wpgb-facet .wpgb-button-facet li:nth-child(1) .wpgb-button[aria-pressed="true"] {
background-color: blue;
border-color: blue;
color: white;
}
%root% .wpgb-facet .wpgb-button-facet li:nth-child(2) .wpgb-button[aria-pressed="true"] {
background-color: red;
border-color: red;
color: white;
}
%root% .wpgb-facet .wpgb-button-facet li:nth-child(3) .wpgb-button[aria-pressed="true"] {
background-color: red;
border-color: red;
color: white;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment