Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Cosineful Palettes [C#]

An asset by sabishidev_
The page banner background of a mountain and forest
Cosineful Palettes [C#] hero image

Quick Information

0 ratings
Cosineful Palettes [C#] icon image
sabishidev_
Cosineful Palettes [C#]

Create beautiful color palettes with cosine formula through editor or scripts.Currently only C# (.NET 8 or later) projects are fully supported.

Supported Engine Version
4.4
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
4 months ago
Git URL
Issue URL

Cosineful Palettes

README Godot Engine README .Net

Cosineful Palette

Addon for Godot Engine 4.4+ (Mono/.NET enabled) that allows you to create beautiful palettes with a simple and intuitive custom resource. Color generation is based on the cosine formula greatly inspired by Inigo Quilez article.

Installation

Recommended way to install Cosineful Palettes is through GodotEnv. In your addons.jsonc file add:

{
    "addons": {
        // ... other addons ...

        "cosineful_palettes": {
            "url": "https://github.com/maxusify/cosineful-palettes",
            "subfolder": "addons/cosineful_palettes"
        }
    }
}

After that you can install the addon by running:

godotenv addons install
dotnet build

Make sure you have BUILT the project and ENABLED addon in your Godot project settings!

Enable addon in Godot project settings

Usage

You can create CosinefulPalette resource through editor inspector:

Create CosinefulPalette resource through editor inspector

If you want to create CosinefulPalette resource programmatically, you can use the CosinefulPalette.Create method:

CosinefulPalette palette = CosinefulPalette.Create(
    brightness: new Vector3(0.25f, 0.25f, 0.25f),
    contrast: new Vector3(0.33f, 0.33f, 0.33f),
    frequency: new Vector3(0.5f, 0.5f, 0.5f),
    range: new Vector3(0.5f, 0.5f, 0.5f)
);

If random outcome is desired, simply use empty constructor and call Randomize method:

CosinefulPalette palette = new CosinefulPalette();
palette.Randomize();

You can also query the palette as follows:

using CosinefulPalettes;

using Godot;

public partial class MyNode : Node
{
    [Export] public CosinefulPalette Palette { get; set; } = default!;

    public override void _Ready()
    {
        // Query the palette using offset value
        // 0.5f means middle of the gradient.
        Color colorFromOffset = Palette.GetColor(0.5f);

        // Query the palette using index value.
        // Here we are querying color with index of 1.
        Color colorFromIndex = Palette.GetColor(1);

        // Query all colors in the palette.
        Color[] colors = Palette.GetColorsArray();

        // Query the palette as a gradient.
        Gradient gradient = Palette.GetColorsGradient();

        // We can randomize the palette and get new colors.
        Palette.Randomize();

        // .. or we can set the component values ourselves.
        Palette.Brightness = new Vector3(0.25f, 0.25f, 0.25f);
        Palette.Contrast = new Vector3(0.33f, 0.33f, 0.33f);
        Palette.Frequency = new Vector3(0.5f, 0.5f, 0.5f);
        Palette.Range = new Vector3(0.5f, 0.5f, 0.5f);

        // ...
    }
}

Create beautiful color palettes with cosine formula through editor or scripts.

Currently only C# (.NET 8 or later) projects are fully supported.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Cosineful Palettes [C#] icon image
sabishidev_
Cosineful Palettes [C#]

Create beautiful color palettes with cosine formula through editor or scripts.Currently only C# (.NET 8 or later) projects are fully supported.

Supported Engine Version
4.4
Version String
1.0.0
License Version
MIT
Support Level
community
Modified Date
4 months ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers