Open LeonardoGentile opened 3 years ago
Hey @LeonardoGentile :wave: Thanks for the issue!
Yeah, that makes sense. @theme-ui/typography
doesn't get as much attention as other packages. I just went through the Git history from the point the file was created and we never did call overrideStyles
:(
If don't have bandwidth to work on this one, but if somebody wants to pick this up:
I made a small branch to test what we'd get from calling overrideStyles
, and the result looks quite useful.
// typography.js types are outdated
const overrideStyles = options?.overrideStyles as any
if (overrideStyles) {
const overrides = overrideStyles(
{
adjustFontSizeTo: rhythm.adjustFontSizeTo,
rhythm: rhythm.rhythm,
scale: getScale(opts),
},
options
)
console.log({ overrides })
}
We could
theme.styles
theme.styles.root
and let it cascade@lachlanjc What do you think?
@LeonardoGentile Curious—what do you use Typography.js for in concert with Theme UI? I’ve never seen the appeal or used it so never contributed to it personally.
@lachlanjc simply put I wanted to use a typography.js theme. Not being a designer I wanted the various spaces and font-sizes to be already determined for me for a defined set of fonts that work/look well together.
Given that on theme-ui front page it's claimed that it will work out of the box with typography.js I wanted to try. But as I've understood not many people uses the typography.js package so I was wondering if it's a good idea to use it at all.
@LeonardoGentile, well... if you're courageous, we'll gladly welcome another contributor :)
The claim it'll work out of the box is probably as old as the integration, and frankly speaking, this might be a first issue with a bug about it.
If you're not building an app where Typography.js is selected by user, copying the Typography theme you like straight to your Theme UI theme might suffice.
It seems that Typography.js
overrideStyles
function defined inside the themes is not called when callingtoTheme
.Example
wp2016
defines an overrideStyles function that will modify part of the theme when instantiated with plaintypography
package.For example, for the
wp2016
theme :but this function is never called by
toTheme
and soh1
will result to have the defaultnot the
Montserrat
family as defined byoverrideStyles
.This means that Typography.js themes will be slightly different when used in theme-ui, isn't it? Or am I missing somethings?