-
Notifications
You must be signed in to change notification settings - Fork 6
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 style options #113
YAML style options #113
Conversation
Have added some more CSS variables: :root {
--cr-trigger-background-color: var(--bs-primary);
--cr-trigger-text-color: var(--bs-light);
--cr-trigger-border-radius: 1em;
--cr-trigger-max-width: 527.98px;
--cr-trigger-outer-margin: 5%;
--cr-sidebar-background-color: var(--bs-primary);
--cr-section-background-color: var(--bs-secondary-bg);
--cr-font-family: var(--bs-body-font-family);
--cr-font-size: 1.15rem;
} These are all hooked up in the YAML (no I've tied some, but not all, of these to Bootstrap CSS variables. Note that the if the corresponding Bootstrap variable is not available, the (a) those variables will only be unavailable if Happy to tweak these defaults or names, though! |
I've caught this up to A few things that cropped up while I was working:
|
Fixed the issue with strings that contains commas (primarily font lists)! This is ready for review I think, @andrewpbray! |
Taking a look now! |
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.
This is awesome!
Two main discussion points:
- After seeing how you disarmed the bootswatch theme in the Demos, I'm inclined to either switch from
$primary
to$dark
or just remove those default links to the bs variables. - It might make sense to rename at least some of the
trigger-
optionsnarrative
options to reflect what they're doing in the css. - I'm kinda inclined to remove
cr-section
undercloseread-html
in the yaml entirely. The original plan was that undercloseread-html
there would becr-section
,cr-trigger
, andcr-sticky
, where you could pass global options to those three core components. As this is maturing though, that doesn't seem like the most useful factoring. Seems like we could just usecr-style
to differentiate that this isn't a generic html key.
_extensions/closeread/closeread.scss
Outdated
--cr-trigger-font-size: 1.15rem; | ||
--cr-poem-font-family: Iowan Old Style, Apple Garamond, Baskerville, Times New Roman, Droid Serif, Times, Source Serif Pro, serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol; | ||
--cr-sidebar-background-color: var(--bs-primary); |
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 was looking at the ends to the demos and noticing that you were opting to override the new default aesthetics that would be pulling from cosmo
. I agree with your choice - if you comment those lines out it looks a little too bold - but it makes me wonder if we want to either change the way we link to these bs defaults or remove them (documenting how the user could add them back) (they'd be able to pass cr-sidebar-background-color: "var(--bs-primary)"
right?
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.
Here are some screenshots of how it currently looks on a few bs themes, Minty, Cosmo, and Yeti:
Minty looks ok I think but there isn't enough contrast on Cosmo or Yeti between sidebar and sidebar text. One option would be to swap out cr-sidebar-background-color: var(--bs-primary)
for cr-sidebar-background-color: var(--bs-dark)
. This would create more of an NYT effect, though we'd def want to link this so a light text color.
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.
Have removed the BS var refs and gone for static default colours! We could adjust them to taste more, but I'm inclined to settle on something and leave further tweaks for the contest, particularly as they're easy to tweak. Left the narrative font family to match Bootstrap.
@@ -5,6 +5,12 @@ description: "Highlight lines or spans of code or line blocks." | |||
format: | |||
closeread-html: | |||
code-tools: true | |||
cr-section: |
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.
As discussed above, this feels like a good amount of work just to get out of a theme that can be oppressive. Seems to me the easiest fix would be to not link to those bs variable by default but allow the user to pass them.
.cr-section .narrative-col { | ||
background-color: rgb(17, 17, 17); | ||
color: white; | ||
min-width: 400px; |
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.
This, I think, is the line that keeps the width of the sidebar constant while expanding the width of the screen.
Awesome! Today's a bit hectic, so it might take me some time to respond to things individually, but the tl;dr is I'm happy with all your comments and proposed changes :) Will see if I can get some time tonight or early tomorrow morning to make your suggested changes and document them over on #109 :) |
These last two commits are a first take at a Should we have both? If so, strong opinions on names? |
Proof of concept here in 8128fb9: if the Lua finds a property defined in the YAML under
format.closeread-html.cr-section.style
, it writes an HTML style block that creates a CSS variable under this name (prefixed with--cr-
), targeting the whole document.In our SASS, there is a default definition for this var covering the whole doc too, and the corresponding properties in the SASS point to it.
This way:
I think this makes sense as an appropriate hierarchy of customisation: we can supply a sensible default, provide easy customisation paths for those who want them, and stay out of power users' way.
This needs to be expanded t more properties, and we might want to choose defaults that lean on Bootstrap if it's available (although I'm not sure we can do that from our SASS, at least until Quarto 1.7).