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

YAML options for colour and other customisations #99

Closed
2 tasks
jimjam-slam opened this issue Oct 17, 2024 · 4 comments
Closed
2 tasks

YAML options for colour and other customisations #99

jimjam-slam opened this issue Oct 17, 2024 · 4 comments
Assignees
Labels
ready-for-review A PR has been implemented and is ready for review and merge

Comments

@jimjam-slam
Copy link
Collaborator

jimjam-slam commented Oct 17, 2024

If the user specifies, for example:

---
title: Test
format:
  closeread-html:
    cr-section:
      sidebar-background-color: orangered
      trigger-background-color: darkgrey
      # note the quoting for hex values
      trigger-text-color: "#efefef"
---

Propogate these options down to the style attribute of all .cr-sections (unless those CSS properties are already defined in the style attribute of that section — eg. if the user has tried to customise themselves).

  • Which properties?

    • Sidebar background color
    • Trigger/narrative background color
    • Trigger/narrative text color
    • Trigger/narrative max width
    • Trigger/narrative margin-start or margin-end (for overlay-left and overlay-right respectively)
    • Trigger/narrative border radius?
    • Sticky content font size
  • Add documentation on these options

@jimjam-slam jimjam-slam added this to the Closeread Contest milestone Oct 17, 2024
@andrewpbray
Copy link
Contributor

See #48 for an early attempt at this.

@jimjam-slam
Copy link
Collaborator Author

Good spotting! The version currently in #48 applies a Bootstrap class, .bg-light, that effectively does the same thing as applying background-color: --bs-light. Though it looks like we had some trouble with it competing with NYTimes styles (maybe a class specificity fight?).

The more comprehensive version we proposed would inject styles directly on the section, except where a style attribute already existed with a competing property. That doesn't take into account the NYTimes case where a user has customised the document with a CSS stylesheet.

This is the appeal of using SCSS: you can supply a default colour using !default and then allow it to be overwritten elsewhere. But that's not on the table right now.

We could also make sensible defaults in closeread.css that broadly follow the Bootstrap theme (and which can be overridden). We only inject styles into the style attributes to sections _if+ a YAML option is specified, since those would override any user-supplied CSS stylesheets (and it's unlikely that a user would pursue both). We can make it clear in documentation that these YAML options override supplied CSS.

@jimjam-slam jimjam-slam self-assigned this Oct 25, 2024
@jimjam-slam
Copy link
Collaborator Author

See #113 for a new approach that I think is more flexible!

@jimjam-slam jimjam-slam added the ready-for-review A PR has been implemented and is ready for review and merge label Oct 27, 2024
@jimjam-slam
Copy link
Collaborator Author

Merged!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-for-review A PR has been implemented and is ready for review and merge
Projects
None yet
Development

No branches or pull requests

2 participants