Skip to content

PA-Toolkit/pa-theme

Repository files navigation

Welcome to pa-theme 👋

Version Documentation Maintenance License: MIT

Creates and edits Project Arrhythmia themes.

Install

npm install pa-theme

Usage

import { Theme } from "pa-theme";
const { Theme } = require("pa-theme");

Creating a theme

You can create a theme:

  • With default colors
const theme = New Theme();
const theme = CreateTheme({
  name: "Theme name",
});
  • With specified colors
const theme = CreateTheme({
  gui: "#FFFFFF",
  background: "#7F7F7F",
});

Working with the theme

Setting the theme's properties

  • Theme's ID (MUST be a unique 6 digit numeric string)
theme.id = "573168";
  • You can also use a helper function
import { ThemeUtils } from "pa-theme";
// ...
theme.id = ThemeUtils.randomThemeId();
  • Setting other properties
theme.name = "Theme";
theme.gui = "#FFFFFF";
theme.objects = ["#ff0000", "#ffa200", "#bfff00" /* ... */];

Building the theme

You can convert the theme to a JSON string/object, then write it to a file.

const fs = require("fs");

fs.writeFileSync("theme.lst", theme.toString());

Reading the theme

You can read an existing theme from the string/object.

const fs = require("fs");

const jsonString = fs.readFileSync("theme.lst");
const json = JSON.parse(jsonString);
const theme = new Theme();
theme.fromJson(json);

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2023 PA Toolkit.
This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator