Text with background color and rounded borders in asciidoctor-pdf

855 views Asked by At

I am trying to create some badge-like texts for my documentation, to highlight the status of some issues.

Here are some examples (jira issues embedded in a confluence wiki)

Example for a "closed"-badge

Example for "waiting for solution"-badge

I even struggle to find any simple way to set a background-color for a text in asciidoctor-pdf.

The most promising attempt was using a themed button-macro.

btn:[Closed]

with this theme-section:

button:
  background-color: #88FF88
  border-color: #33FF33
  border-radius: 5
  border-width: 0.5
  border-offset: 3.0

The result is quite close to what I hoped to achieve, however I cannot have buttons with different colors. Or is it possible to overwrite the theme-values in the *.adoc file itself?

Is there any other possibility to create something similar in asciidoc-pdf?

1

There are 1 answers

1
Nicolai Henriksen On BEST ANSWER

You might be able to achive this with roles.

I have at the top of my .adoc file:

:pdf-theme: my-theme.yml

Then I have a file called my-theme.yml in the same directory as my .adoc:

extends: default

role:
  done:
    font-color: ffffff
    background-color: #88FF88
    border-color: #33FF33
    border-radius: 2
    border-width: 0.5
    border-offset: .0

When I use it, I do this:

[.done]#DONE#