Color for Text

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Color for Text

Conrad
Hello,

I refer to https://discuss.asciidoctor.org/Asciidoctor-pdf-color-question-td4313.html#a5825.

How can I colorize text? If I understand the thread correctly there will be maybe a solution. The thread is from 2016.

I am using the downloadable version of AsciidoctorJ and I did not finde a stylesheet for pdf.

I tried "[red]#this is printed in red#" and it works with AsciidocFX, but not with AsciidoctorJ. Unfortunately the solution with AsciidocFX causes other problems (e.g. lack of TOC).

Conrad
Reply | Threaded
Open this post in threaded view
|

Re: Color for Text

habamax
Recent asciidoctor-pdf can have it. You should define a role in your theme and then use it:

For example, I have the following in my theme:

role:
  big:
    font_size: $base_font_size_large
  small:
    font_size: $base_font_size_small
  smaller:
    font_size: $base_font_size_small * 0.8
  tiny:
    font_size: $base_font_size_small * 0.5
  red:
    font_color: #ff0000
  green:
    font_color: #00aa00
  blue:
    font_color: #0000ff
  cyan:
    font_color: #00cccc
  pink:
    font_color: #cc00cc
  brown:
    font_color: #A0522D


Then in asciidoctor file:

[green]#Green text#
Reply | Threaded
Open this post in threaded view
|

Re: Color for Text

Conrad
Thank you. I will try this.

Are you (re)using a Standard theme? Could you tell me which one? I never used a pdf-theme, that's why I am asking.
Reply | Threaded
Open this post in threaded view
|

Re: Color for Text

habamax
At first I have used completely non-standard theme...

Now I just redefine some stuff, like brand colors, title-page, header and footer. :)


Check: https://github.com/asciidoctor/asciidoctor-pdf/#themes

Reply | Threaded
Open this post in threaded view
|

Re: Color for Text

mojavelinux
Administrator
> Now I just redefine some stuff, like brand colors, title-page, header and footer. :)

I love to hear that this new feature is proving helpful! Yeah!

-Dan

On Fri, Jan 24, 2020 at 12:20 AM habamax [via Asciidoctor :: Discussion] <[hidden email]> wrote:
At first I have used completely non-standard theme...

Now I just redefine some stuff, like brand colors, title-page, header and footer. :)


Check: https://github.com/asciidoctor/asciidoctor-pdf/#themes




If you reply to this email, your message will be added to the discussion below:
https://discuss.asciidoctor.org/Color-for-Text-tp7509p7527.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML


--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux
Reply | Threaded
Open this post in threaded view
|

Re: Color for Text

habamax
> I love to hear that this new feature is proving helpful! Yeah!

Yes, indeed! Default theme as of now looks beautiful. (this is subjective of course, but nevertheless)
Reply | Threaded
Open this post in threaded view
|

Re: Color for Text

youngjim01
Hello, I'm new to AsciiDoc, and I seem to be having the same basic problem as the OP, except not in PDF.  

I'm uploading AsciiDoc files to GitHub / GitLab, but I can't get colored text to display in the rendered HTML.

The project is available at https://github.com/youngjim01/asciidoc-test

I've also posted the same question on Stack Overflow at https://stackoverflow.com/questions/69368301/how-to-get-rendered-colored-text-in-gitlab-github-using-asciidoc

If anybody can point me in the right direction, I'd be very grateful.


Reply | Threaded
Open this post in threaded view
|

Re: Color for Text

mojavelinux
Administrator
GitHub and GitLab do not permit using colors in content in the repository preview view. This has been requested countless times, and the response is always to reject that request. (It's also beyond the scope of what Asciidoctor can control).

This is why I say that the repository preview view on GitHub and GitLab is not a publishing target. Rather, it's just a (low-fidelity) preview. If you want colors and other custom styling, you should process the content with Asciidoctor and publish it to GitHub Pages or GitLab Pages, respectively.

Best Regards,

-Dan
Reply | Threaded
Open this post in threaded view
|

Re: Color for Text

youngjim01
Dan,

Thank you.