跳到正文

ColorAPI

作者:MisterBartra

Lightweight chromatic algebra, color spaces, and animation library for Minecraft Fabric. Features RGB/HSV conversions, easing curves, color transitions, and texture extraction.

收藏

介绍

中文介绍正在准备中,下面暂时显示原文。

🎨 ColorAPI

Fabric
Minecraft
Java
License

ColorAPI is an ultra-lightweight, high-performance mathematical and chromatic animation library designed for modern Minecraft Fabric (1.21.11+). It decouples pure color algebra and timing curves from complex rendering engines, providing a clean, reusable foundation for colored lighting, GUI widgets, particle systems, and cosmetic tinting.


⚡ Core Features

  • 🌈 Comprehensive Color Spaces:
    * Immutable ColorRGB record supporting sRGB, Linear spaces, gamma correction, alpha channels, and packed ARGB/RGB conversions.
    * ColorHSV record with robust bidirectional RGB \(\leftrightarrow\) HSV mapping.
  • 🧮 Pure Chromatic Algebra (ColorMath):
    * Weighted multi-source color blending (blendColors).
    * Clamped linear interpolation (lerp).
    * Photometric attenuation modulation (modulate).
    * Additive light accumulation (additiveAccumulate).
  • 📈 Rich Easing & Animation Engine (EasingMath):
    * Easing curves: Linear, Ease In/Out, Ease In-Out, Quadratic, Cubic, Sine, Exponential, Bounce, Elastic, and Step.
    * Temporal transition controller (ColorTransition) for smooth tick-to-tick or frame-to-frame color fading.
  • 📦 Decoupled Data Structures:
    * Standardized Keyframe, Sequence, and Profile records for sequencing complex multi-stage color animations.
  • 🖼️ Texture & Asset Color Extraction:
    * Native utilities for calculating dominant/average colors from block sprites and textures.

💻 Developer Quick Start

Add ColorAPI to your build.gradle:

repositories {
    mavenCentral()
    // or mavenLocal() if building from source
}

dependencies {
    modImplementation "mb.bartra:colorapi:1.0"
}

Basic Color Interpolation & Blending:

import mb.bartra.colorapi.ColorAPI;
import mb.bartra.colorapi.core.ColorRGB;
import mb.bartra.colorapi.core.ColorMath;

// 1. Simple Lerp between two hex colors
int startColor = 0xFF0000; // Red
int endColor   = 0x0000FF; // Blue
int blended    = ColorAPI.lerp(startColor, endColor, 0.5f); // Purple

// 2. Linear Color Modulation
ColorRGB light = ColorRGB.fromRgb(0xFFAA00);
ColorRGB shaded = light.toLinear().multiply(0.75f).toSrgb();

📄 License

ColorAPI is distributed under the open-source MIT License. Free for personal use, modpacks, and third-party mod integrations.

常见问题

ColorAPI 支持哪些 Minecraft 版本?

ColorAPI 支持 Minecraft Java 版 1.21.11,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。

ColorAPI 怎么安装?

先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。

评论

登录后评论和评分

MisterBartra 的其他作品

查看全部 →