-
Notifications
You must be signed in to change notification settings - Fork 24
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
feat: add cover color-changing-cover #129
feat: add cover color-changing-cover #129
Conversation
Can we achieve translucency by modifying the alpha value instead of fixing a color? We can think about the hacky code that I have as proof of concept below #set page(width: 20em, height: auto)
#let update-alpha(constructor: rgb, color, alpha) = constructor(..color.components(alpha: true).slice(0, -1), alpha)
#show par: it => {
if repr(text.fill).split("(").at(0) == "rgb" {
set text(fill: update-alpha(text.fill, 50%))
it
} else {
it
}
}
// ----------------
// content
// ----------------
#set text(rgb("#000000"))
Test
#set text(rgb("#ff0000"))
Test |
What do you think about this approach? The |
if it.has("child") { | ||
return _contains-text(it.child) | ||
} | ||
if it.has("children") { |
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.
The table
and grid
types also have children
, I'm not sure if this should be included?
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 understand. It might be good to have an option to toggle the behaviour, or exclude those elements (using util.is-sequence
?)
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.
Since the table has borders, we should use util.is-sequence
as default, but it can indeed be made into a configuration.
Quick Update: I discovered that the new |
Update: The enhanced function now provides improved handling of color-changing texts. This is achieved by utilizing the NoteThe decision to use |
While this is slightly tangential to the current PR, I'd like to propose an improvement to the #let update-alpha(color, alpha) = color.opacify(100%).transparentize(alpha) This revised implementation can handle all color constructors uniformly. It first ensures full opacity with |
If |
My latest proposal addresses that issue! |
Thanks! |
This pull request introduces a new (pseudo) semitransparent cover function that provides a method for hiding content in slides. The function changes the text color of elements to a specified color if they contain text. If an element does not contain text, it can use
hide
as a fallback.This implementation has been successfully tested with the default examples and the specific example provided in issue #112.