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 customising the Intro section via PageColor #582

Conversation

dobromir-hristov
Copy link
Contributor

Bug/issue #, if applicable: 107241548

Summary

Allows Documentation page Intro section background color to be customised on a per-page level, using the new @PageColor directive.

The color can be further changed from the pre-defined set of colors, using the theme-setttings.json file. For info on how to do that, chekc the Forum post

Dependencies

Testing

Steps:

  1. Using docc from the dep PR, add @PageColor directive to a few pages of a docs of your choice
  2. Assert that visiting those pages, the Intro sections have the corresponding page color.
  3. Assert you can override those colors, using the theme-settings.json file, like explained in the Forum post.

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

ethan-kusters added a commit to ethan-kusters/swift-docc that referenced this pull request Apr 7, 2023
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(blue)
    }

    ![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:

  - `color`: An unnamed parameter that accepts one of the following:

     - `blue`: A context-dependent blue color.

     - `gray`: A context-dependent gray color.

     - `green`: A context-dependent orange color.

     - `orange`: A context-dependent orange color.

     - `purple`: A context-dependent purple color.

     - `red`: A context-dependent red color.

     - `yellow`: A context-dependent yellow color.

`@PageColor` is described on the Swift forums here:
https://forums.swift.org/t/support-for-customizing-a-page-s-accent-color-in-swift-docc/64093

Dependencies:

- swiftlang/swift-docc-render#582

rdar://106153042
ethan-kusters added a commit to ethan-kusters/swift-docc that referenced this pull request Apr 7, 2023
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(blue)
    }

    ![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:

  - `color`: An unnamed parameter that accepts one of the following:

     - `blue`: A context-dependent blue color.

     - `gray`: A context-dependent gray color.

     - `green`: A context-dependent orange color.

     - `orange`: A context-dependent orange color.

     - `purple`: A context-dependent purple color.

     - `red`: A context-dependent red color.

     - `yellow`: A context-dependent yellow color.

`@PageColor` is described on the Swift forums here:
https://forums.swift.org/t/support-for-customizing-a-page-s-accent-color-in-swift-docc/64093

Dependencies:

- swiftlang/swift-docc-render#582

rdar://106153042
ethan-kusters added a commit to swiftlang/swift-docc that referenced this pull request Apr 7, 2023
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(blue)
    }

    ![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:

  - `color`: An unnamed parameter that accepts one of the following:

     - `blue`: A context-dependent blue color.

     - `gray`: A context-dependent gray color.

     - `green`: A context-dependent orange color.

     - `orange`: A context-dependent orange color.

     - `purple`: A context-dependent purple color.

     - `red`: A context-dependent red color.

     - `yellow`: A context-dependent yellow color.

`@PageColor` is described on the Swift forums here:
https://forums.swift.org/t/support-for-customizing-a-page-s-accent-color-in-swift-docc/64093

Dependencies:

- swiftlang/swift-docc-render#582

rdar://106153042
ethan-kusters added a commit to ethan-kusters/swift-docc that referenced this pull request Apr 7, 2023
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(blue)
    }

    ![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:

  - `color`: An unnamed parameter that accepts one of the following:

     - `blue`: A context-dependent blue color.

     - `gray`: A context-dependent gray color.

     - `green`: A context-dependent orange color.

     - `orange`: A context-dependent orange color.

     - `purple`: A context-dependent purple color.

     - `red`: A context-dependent red color.

     - `yellow`: A context-dependent yellow color.

`@PageColor` is described on the Swift forums here:
https://forums.swift.org/t/support-for-customizing-a-page-s-accent-color-in-swift-docc/64093

Dependencies:

- swiftlang/swift-docc-render#582

rdar://106153042
@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

ethan-kusters added a commit to swiftlang/swift-docc that referenced this pull request Apr 11, 2023
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(blue)
    }

    ![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:

  - `color`: An unnamed parameter that accepts one of the following:

     - `blue`: A context-dependent blue color.

     - `gray`: A context-dependent gray color.

     - `green`: A context-dependent orange color.

     - `orange`: A context-dependent orange color.

     - `purple`: A context-dependent purple color.

     - `red`: A context-dependent red color.

     - `yellow`: A context-dependent yellow color.

`@PageColor` is described on the Swift forums here:
https://forums.swift.org/t/support-for-customizing-a-page-s-accent-color-in-swift-docc/64093

Dependencies:

- swiftlang/swift-docc-render#582

rdar://106153042
@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

@dobromir-hristov dobromir-hristov merged commit b367546 into swiftlang:main Apr 12, 2023
@dobromir-hristov dobromir-hristov deleted the dhristov/r107241548-customisable-page-theme-color branch April 12, 2023 06:39
dobromir-hristov pushed a commit to dobromir-hristov/swift-docc-render that referenced this pull request Apr 12, 2023
dobromir-hristov pushed a commit that referenced this pull request Apr 12, 2023
hqhhuang pushed a commit to hqhhuang/swift-docc-render that referenced this pull request Apr 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants