Using this post, I created a variable in my file. Now I want to use it to define a background color in my array :
:first-color: #C0FFEE
[%noheader]
|===
h|{set:cellbgcolor:{first-color}} My Title
|{set:cellbgcolor} First cell
|===
But It did not work, all I have is an extra "}" in my title :
Is there a way to use variable to define my backgroung color ?
Since my previous answer may be useful in other contexts where CSS styling is supported, I'd rather not modify it and recommend a new solution. What do you think about creating a theme?
Like in this YAML configuration file. You can name it my-theme.yml
:
page:
background-color: #ffffff
table:
head:
background-color: $first-color
base:
font-color: #333333
Now, this is your asciidoc file:
:first-color: #C0FFEE
[%noheader,cols="100%"]
|===
h|My Title
|First cell
|===
And when converting to PDF, use the theme file:
asciidoctor-pdf -a pdf-theme=my-theme.yml your-file.adoc