A library for modifying and creating Project Arrhythmia themes.
- Right click your project in the Solution explorer
- Click "Manage NuGet packages"
- Search "PAThemeToolkit" and select the first result
- Click "Install"
You can download the package manually on it's NuGet page.
It is recommended to use the constructor that takes in a string name
.
Theme myTheme = new Theme("Hello Theme Toolkit!");
There are multiple ways to create a color object:
Color myColor = new Color("#7F7F7F");
Color myOtherColor = new Color("7F7F7F");
Color myColor = new Color(0.5f, 0.5f, 0.5f);
Color myColor = new Color(127, 127, 127);
You can modify color's R
, G
, and B
float
values:
myColor.R = 0.5f;
myColor.G = 0.5f;
myColor.B = 0.5f;
Or int
values:
myColor.RInt = 127;
myColor.GInt = 127;
myColor.BInt = 127;
A single Project Arrhythmia theme has 24 colors:
- 1 background color
- 1 GUI color
- 4 players colors
- 9 objects colors
- 9 background objects colors
You can assign a single color like this:
Theme myTheme = new Theme("Gray Background");
Color myColor = new Color("#7F7F7F");
myTheme.Background = myColor;
And an array of colors like this:
Color[] myColors = new Color[4];
myColors[0] = new Color("#7F7F7F");
myColors[1] = new Color("7F7F7F");
myColors[2] = new Color(127, 127, 127);
myColors[3] = new Color(0.5f, 0.5f, 0.5f);
myTheme.Players = myColors;
You can either get a JSON object representing the theme or export it to a file. Note that if the file already exists, it will be overwritten.
theme.ExportToFile("my_new_theme.lst");
JSONNode json = theme.ToJson();
using System;
using System.IO;
using SimpleJSON;
namespace PAThemeToolkit.Test
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Theme creation test");
// Create a new theme
Theme theme = new Theme("Full Gray");
// Set GUI color from Hex string
theme.GUI = new Color("#7F7F7F");
// Set background color from RGB [0..255]
theme.Background = new Color(127, 127, 127);
// Set arrays of colors
theme.Players = new Color[4];
for (int i = 0; i < 4; i++)
{
// Set color from RGB [0..1]
theme.Players[i] = new Color(0.5f, 0.5f, 0.5f);
}
theme.Objects = new Color[9];
for (int i = 0; i < 9; i++)
{
// Set color from Hex string (without #)
theme.Objects[i] = new Color("7f7f7f");
}
theme.BackgroundObjects = new Color[9];
for (int i = 0; i < 9; i++)
{
theme.BackgroundObjects[i] = new Color("#7f7f7f");
}
// Export to file
theme.ExportToFile("full_white.lst");
Console.WriteLine("Theme reading test");
Theme readTheme = new Theme(JSON.Parse(File.ReadAllText("full_white.lst")));
Console.WriteLine(readTheme);
}
}
}