c

colorful-boxes

@preview

Predefined colorful boxes to spice up your document

v1.4.3
MIT

Package Information

Last Updated
Categories
components

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/colorful-boxes:1.4.3

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/colorful-boxes:1.4.3": *

Version History

1.4.3
b2d46637a028...
1.4.2
a7e165580371...
1.4.1
cd605ca9cb78...
1.4.0
6ffb674d7980...
1.3.1
4a4e662acc6a...
1.2.0
8ff2b2925665...
1.1.0
fe87ddc8f6fa...
1.0.0
42e479837785...

Typst Boxes

Typst Boxes is a Typst package for adding colorful, customizable boxes to your documents.

➡️ Explore the live example project


Table of Contents

  1. Features
  2. Examples & Usage
  3. Contributing
  4. License

Features

  • Predefined color themes: black, red, blue, green, purple, gold, and more
  • slanted-colorbox for angled headlines
  • outline-colorbox for simple bordered layouts
  • stickybox for rotatable notes
  • Custom color support via color parameter (string or dictionary)
  • Disable sticky tape with tape: false

Examples & Usage

Colorbox

colorbox_example

#colorbox(
  title: lorem(5),
  color: "blue",
  radius: 2pt,
  width: auto,
)[
  #lorem(50)
]

Use other built‑in colors:
"red", "green", "purple", "gold", "gray", "cyan", etc.

Custom color via dictionary:

#colorbox(
  title: "Custom Theme",
  color: (
    fill: rgb("#f0f8ff"),
    stroke: rgb("#00bfff"),
    title: rgb("#002366")
  ),
  radius: 4pt,
  width: auto
)[
  "This box uses a custom color dictionary."
]

Slanted Colorbox

slantedColorbox_example

#slanted-colorbox(
  title: lorem(5),
  color: "red",
  radius: 0pt,
  width: auto,
)[
  #lorem(50)
]

Outline Colorbox

outlinebox_example

#outline-colorbox(
  title: lorem(5),
  width: auto,
  radius: 2pt,
  centering: false,
)[
  #lorem(50)
]

#outline-colorbox(
  title: lorem(5),
  color: "green",
  width: auto,
  radius: 2pt,
  centering: true,
)[
  #lorem(50)
]

Custom colors via dictionary:

#outline-colorbox(
  title: "Soft Green",
  color: (
    fill: green.lighten(70%),
    stroke: green.darken(40%)
  ),
  width: auto,
  radius: 2pt,
  centering: false,
)[
  #lorem(20)
]

stickybox

Basic

#stickybox(
  rotation: 5deg,
  width: 5cm,
)[
  #lorem(20)
]

Custom Background Color

#stickybox(
  width: 5cm,
  rotation: -5deg,
  fill: rgb("#ffb6a6"),
)[
  #lorem(20)
]

Disable Tape

#stickybox(
  width: 8cm,
  fill: rgb("#33ff57"),
  tape: false,
)[
  "No tape here!"
]

Contributing

We welcome contributions!

  1. Fork this repository
  2. Create a feature branch
  3. Open a pull request with a clear description

License

This project is licensed under the MIT License. See LICENSE for details.