View Single Post
Old 01-21-2024, 02:08 AM   #9192
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,209
Karma: 5006097
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
The %(var)s substitution is a built-in feature of the INI file parser. It doesn't know anything about FFF metadata entries. (Honestly, I'd rather it didn't--we have to escape % to %% far more often than it's useful.)

I was all set to tell you it's not possible, when I realized, holy crap, it is! An ugly way I'm mildly ashamed of, but a way.

Way back when, I stuck output_css into the story metadata as a convenient (if cheesy) way to pass it to the writer code. And it's been that way ever since.

Which means output_css can be edited by replace_metadata.

Here's the basic version that works for me. Needed to add "Audiences" to use == matching.
Code:
[archiveofourown.org]

## fff_titlepage_color_replace can be something else, but it should 
## be unique within output_css and  ideally not conflict with regex
## The final FFFFFF line is just to make it a real color if nothing else matches.  

add_to_replace_metadata:
 output_css=>fff_titlepage_color_replace=>527200&&rating==General Audiences
 output_css=>fff_titlepage_color_replace=>A69905&&rating==Teen And Up Audiences
 output_css=>fff_titlepage_color_replace=>AD5600&&rating==Mature
 output_css=>fff_titlepage_color_replace=>980101&&rating==Explicit
 output_css=>fff_titlepage_color_replace=>1B1B1B&&rating==Not Rated
 output_css=>fff_titlepage_color_replace=>FFFFFF

add_to_output_css:
 body.fff_titlepage { background-color: #fff_titlepage_color_replace; }
JimmXinu is online now   Reply With Quote