-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add authoring support for a @PageColor
directive
#520
Conversation
Adds a new `@PageColor` metadata directive that allows for customizing the color used to represent a given page. `@PageColor` gives authors control over the color used when rendering a page – initially this will affect the background color Swift-DocC-Render uses in the page's introduction (hero) section. Example: # What's New in SlothCreator @metadata { @PageColor(red: 233, green: 58, blue: 43) } ![A sloth on a tree wearing a fedora.](sloth-fedora) Let's check out what's new in SlothCreator! ... Details: `@PageColor` accepts the following parameters: - `red`: An integer value between `0` and `255` that represents the amount of red in the color. - `green`: An integer value between `0` and `255` that represents the amount of green in the color. - `blue`: An integer value between `0` and `255` that represents the amount of blue in the color. - `opacity`: An optional floating-point integer value between `0.0` and `1.0` that represents the opacity of the color. Defaults to `1.0`. This forums post for this change is still pending. rdar://106153042
@swift-ci please test |
@PageColor
directive@PageColor
directive
I have a few questions:
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may not have the full context here but to me this functionality feels more at home in with the rest of the theming support.
It's a little different in that the other theme configuration applies to all pages and this applies to a single page but I feel that the better solution would be to improve the theming support so that a theme configuration can be scoped to a single page.
Thank you for the feedback here! Closing in favor of |
Bug/issue #, if applicable: rdar://106153042
Summary
Adds a new
@PageColor
metadata directive that allows for customizing the color used to represent a given page.@PageColor
gives authors control over the color used when rendering a page – initially this will affect the background color Swift-DocC-Render uses in the page's introduction (hero) section.Example:
Details:
@PageColor
accepts the following parameters:red
: An integer value between0
and255
that represents the amount of red in the color.green
: An integer value between0
and255
that represents the amount of green in the color.blue
: An integer value between0
and255
that represents the amount of blue in the color.opacity
: An optional floating-point value between0.0
and1.0
that represents the opacity of the color.Defaults to
1.0
.This forums post for this change is still pending.
Dependencies
Swift-DocC-Render PR TBD.
Testing
Add
@PageColor
to the@Metadata
directive in a Swift-DocC article or extension file and confirm that the resulting RenderNode includes acolor
metadata property.Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.
./bin/test
script and it succeeded