I’d like to use some colors from the wordpress admin theme to build my back-end plugin’s theme, based on Bootstrap-3 & SASS/LESS.
I think I saw a few functions to get the colors of the admin theme but I am not sure its the right way to go. I am aware there might be 3th party admin themes but I’d be already happy to get the standard-themes covered.
Anyone knows how to do it?
thanks.
ps: a javascript solution is ok too.
update: I can’t rely on WordPress specific markup since my app is also used outside of WP. All i want is build my plugin’s theme (Bootstrap 3-4) using the WordPress’s admin theme’s CSS variables (if such exists). So if anyone knows how to build a variables.less/scss file for the WordPress admin themes, then I am done I guess.
Building admin interfaces in WordPress is quite ad hoc. Which is historical reason for many of those interface looking nothing like WP admin surrounding them.
In general it works in terms of markup, rather than colors. You don’t code in terms of “black” or “red”, but in semantic terms like “primary” or “notification”.
There are are some plugins/guides out there that help figure out markup (for example WP Admin Pattern Library) but they aren’t really complete/official/whatever.
So in general the process loosely works as following:
- Find a part of native WP admin with elements you need.
- Ripoff and reuse HTML markup of those elements.
- Fine tune whatever is missing with your own CSS.
- Keep an eye out for changes in markup with new WP releases (it likes to fiddle and keep admin pretty every couple years).