Allows CSS/SVG named colors to be used directly in a Typst document.
Getting Started
These instructions will get you a copy of the project up and running on the Typst web app.
#import "@preview/niram-css:0.1.0": *
Normal text may be #text(fill: css("crimson"))[colored so.]
Installation
Follow these steps to set up your development environment and prepare for contributing to the project:
-
Typst: Install Typst (version 0.13.0 or higher) using the official installation instructions. Typst is required to work with the core functionality of the project.
-
Just: Install Just, a handy command runner for executing predefined tasks. You can install it using a package manager or by downloading a pre-built binary. Refer to the available packages for installation instructions specific to your operating system.
-
tytanic: Install tytanic, a library essential for testing and working with Typst projects. Use the quickstart installation guide to get it up and running.
-
Clone the Repository: Download the project’s source code by cloning the repository to your local machine:
git clone https://github.com/nandac/niram-css.git
Once you’ve completed these steps, your development environment will be ready.
Next Steps
The niram-css
package source code is located at:
src/niram-css.typ
This is where you will make any necessary changes to the module.
Running Tests
To test the functionality of the module locally, run the predefined test cases using the following command:
just test
Ensure that all tests pass before submitting any changes to maintain the project’s integrity.
If you want to test the module with a Typst file, you can install the niram-css
package locally in the preview
location by running:
just install-preview
Once installed, you can import the package into your Typst file using the following statement:
#import "@preview/niram-css:0.1.0": *
This setup allows you to experiment with the module in a Typst file before finalizing your changes.
Usage
The following examples demonstrate the usage of the niram-css
package in various cases:
#import "@preview/niram-css:0.1.0": *
#align(center)[
#polygon.regular(
fill: css("darkgoldenrod").lighten(60%),
stroke: (paint: css("darkgoldenrod"), thickness: 4pt, cap: "round"),
size: 60mm,
vertices: 6,
)
]
For more examples, in-depth explanations, and the PDF output, please refer to the project manual.
Acknowledgments
Special thanks to the Typst community on Discord for their invaluable assistance and support during the development of this package.