Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow color to be specified for a font-based icon #349

Closed
mojavelinux opened this issue Nov 2, 2015 · 8 comments
Closed

Allow color to be specified for a font-based icon #349

mojavelinux opened this issue Nov 2, 2015 · 8 comments
Assignees
Milestone

Comments

@mojavelinux
Copy link
Member

Allow the color attribute to be specified on the icon macro to control the color of the font. The color can be specified using any format that is permitted in the PDF theme file (see /~https://github.com/asciidoctor/asciidoctor-pdf/blob/master/docs/theming-guide.adoc#colors).

Example:

icon:heart[color=ff0000]
icon:heart[color="255,0,0"]
icon:heart[color="0,0.99,1,0"]
@mojavelinux mojavelinux self-assigned this Nov 2, 2015
@mojavelinux mojavelinux added this to the v1.5.0.beta.1 milestone Nov 2, 2015
@mojavelinux
Copy link
Member Author

Currently, the workaround is to use Prawn-specific markup to set the color:

+++<color rgb="ff0000">+++icon:heart[]+++</color>+++

@lit-uriy
Copy link

lit-uriy commented May 17, 2017

Why another attribute?
In the User manual (http://asciidoctor.org/docs/user-manual/#inline-icons) already provided color throw role, like this:

icon:tags[role="blue"] ruby, asciidoctor

My code:

WARNING: Этот WARNING.

Это icon:flag[role="red"] инлайн иконка с красным флажком, а эта icon:tags[role="blue"] с синим ярлыком

In HTML output icon with color and admonition with color,
screenshot_28

but PDF output - admonition with color, icon - WITHOUT color
screenshot_29

P.S. To avoid confusion in the attributes, it is better to use only one, of course, the attribute "color" is more obvious, but then you need to remove from the documentation the attribute "role" (to leave just for compatibility).

@mojavelinux
Copy link
Member Author

I agree that a role (aka class) would be better. But that would mean we need to implement generic roles in the theme. We could make that part of this fix, or at least a simplified version of it (where we just look for the color).

@mojavelinux
Copy link
Member Author

Something like this in the theme:

role:
  red: #ff0000

And this in the AsciiDoc:

icon:heart[role=red]

I'd be happy with that.

(I put the role under the role category so it doesn't conflict with other top-level category names).

@lit-uriy
Copy link

When can this feature appear in Asciidoctor-pdf?

@mojavelinux
Copy link
Member Author

I've already scheduled it for the next alpha, so I will try to stick to that if I can. Right now I'm busy working on the next release of Asciidoctor core.

@lit-uriy
Copy link

mojavelinux, thank you

@mojavelinux
Copy link
Member Author

Roles for inline elements are now supported. Now we just need to apply the role to the icon.

@mojavelinux mojavelinux modified the milestones: v1.5.0, v1.5.0.beta.3 Aug 16, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Aug 18, 2019
mojavelinux added a commit to mojavelinux/asciidoctor-pdf that referenced this issue Aug 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants