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

fix #17 #90

Closed
wants to merge 1 commit into from
Closed

fix #17 #90

wants to merge 1 commit into from

Conversation

ntjess
Copy link
Contributor

@ntjess ntjess commented Aug 29, 2023

Fix #17 by providing a more generalized cover function. Works with several content types (not just text) and on several background colors instead of assuming white. Sample usage:

#import "polylux.typ": *

#set page(width: 2in, height: 2.2in, background: rect(width: 100%, height: 100%))

#let slide = polylux-slide

#let img = image("assets/logo.png", height: 0.5in)


#slide[
  = Hello, world

  #uncover(2, mode: "transparent", img)

  #set text(fill: white)
  #let bg(fill, h: 45%) = place(rect(width: 100%, height: h, fill: fill))

  // Typst `green` is not true green
  #add-hider-mode("green", cover-with-rect.with(fill: rgb(46, 204, 64, 90%)))
  // Use "transparent" on black background as default when no
  // mode is specified
  #add-hider-mode("default", logic.cover-with-black-rect)
  #bg(black)
  #uncover(2, [Some text])
  #side-by-side[
    #uncover(2, img)
  ][
    // Let the user specify their own modes when operating on nonstandard background
    // colors
    #uncover(2, mode: "green", box(img, fill: green, outset: 1em))
  ]
]

Produces:
image

@ntjess
Copy link
Contributor Author

ntjess commented Aug 29, 2023

For some reason, GitHub isn't updating this PR in synch with changes to my main branch. Closing this PR so I can reopen another that's up-to-date.

@ntjess ntjess closed this Aug 29, 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.

Make transparent covering actually transparent
1 participant