Skip to content

Small java library to create custom gradients using java.awt.Color

Notifications You must be signed in to change notification settings

LoisDuplain/gradient-generator

Repository files navigation

🍭 gradient-generator 🎨

java version: 16 language: java 42 login: lduplain

gradient-generator is a small java library to create custom gradients using java.awt.Color.

Created by Loïs Duplain. (42login: lduplain, 42mail: lduplain@student.42lyon.fr)

🏗️ Compile

To basically compile program:

./gradlew build

To clean all *.o in project:

./gradlew clean

📚 Usage

Example:

public static void main(String[] args) {
    Gradient gradient = new Gradient();
    gradient.getColors().add(Color.YELLOW);
    gradient.getColors().add(Color.ORANGE);
    gradient.getColors().add(Color.RED);
    gradient.getColors().add(Color.MAGENTA);
    gradient.getColors().add(Color.BLUE);

    for (int i = 0; i < 1920; i++) {
        Color color = gradient.getColor(i, 1920);
        // 'color' variable now contains the color at the position 'i'
        // in a gradient of size '1920'
    }
}

Result (run library to see it):

example result

⚖️ Copyright

Loïs Duplain (lduplain) © 2021

About

Small java library to create custom gradients using java.awt.Color

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages