{"id":27697861,"url":"https://github.com/croabeast/prismaticapi","last_synced_at":"2026-05-23T03:15:35.653Z","repository":{"id":286532770,"uuid":"961686209","full_name":"CroaBeast/PrismaticAPI","owner":"CroaBeast","description":"PrismaticAPI is a versatile library for advanced color manipulation and text formatting in Bukkit/Spigot/Paper plugins.","archived":false,"fork":false,"pushed_at":"2025-07-26T00:49:07.000Z","size":58,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-26T07:37:55.706Z","etag":null,"topics":["library","plugin","spigot","spigot-plugin","spigotmc"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CroaBeast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["CroaBeast"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"croabeast","thanks_dev":null,"custom":"https://www.paypal.com/donate/?hosted_button_id=FQQR9FEHPLNQL"}},"created_at":"2025-04-07T02:10:03.000Z","updated_at":"2025-07-26T00:49:10.000Z","dependencies_parsed_at":"2026-03-09T02:01:08.337Z","dependency_job_id":null,"html_url":"https://github.com/CroaBeast/PrismaticAPI","commit_stats":null,"previous_names":["croabeast/prismaticapi"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/CroaBeast/PrismaticAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CroaBeast%2FPrismaticAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CroaBeast%2FPrismaticAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CroaBeast%2FPrismaticAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CroaBeast%2FPrismaticAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CroaBeast","download_url":"https://codeload.github.com/CroaBeast/PrismaticAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CroaBeast%2FPrismaticAPI/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30280337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T01:43:35.720Z","status":"online","status_checked_at":"2026-03-09T02:00:08.011Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","plugin","spigot","spigot-plugin","spigotmc"],"created_at":"2025-04-25T16:21:18.870Z","updated_at":"2026-05-23T03:15:35.646Z","avatar_url":"https://github.com/CroaBeast.png","language":"Java","funding_links":["https://github.com/sponsors/CroaBeast","https://buymeacoffee.com/croabeast","https://www.paypal.com/donate/?hosted_button_id=FQQR9FEHPLNQL"],"categories":[],"sub_categories":[],"readme":"# PrismaticAPI\n\nPrismaticAPI is a Bukkit/Paper text-formatting library for RGB colors, gradients, rainbows, MiniMessage-aware parsing and legacy-safe fallback.\n\nVersion `1.4.0` reorganizes the public API around two facades backed by the same formatting engine:\n\n- `PrismaticAPI.legacy()` returns `Formatter\u003cString\u003e`\n- `PrismaticAPI.adventure()` returns `Formatter\u003cComponent\u003e`\n\nThe old top-level methods such as `PrismaticAPI.colorize(...)` and `PrismaticAPI.applyGradient(...)` still exist and now delegate to `legacy()` for compatibility.\n\n## What Changed In 1.4.0\n\n- Added `PrismaticAPI.legacy()` as the always-safe string formatter facade.\n- Added `PrismaticAPI.adventure()` as the optional Adventure formatter facade.\n- Added `PrismaticAPI.isAdventureAvailable()` to guard Adventure-only code paths.\n- Removed `RichText`.\n- Removed `colorizeText(...)`, `applyColorText(...)`, `applyGradientText(...)` and `applyRainbowText(...)`.\n- Kept the existing legacy top-level helpers as compatibility delegates to `legacy()`.\n\n## Features\n\n- One formatting engine for legacy strings and Adventure components.\n- Multiple single-color RGB syntaxes.\n- Gradient and rainbow tags.\n- Optional MiniMessage support at runtime.\n- Player-aware legacy fallback through VNC/ViaVersion support.\n- Safe startup on runtimes where Adventure is not present.\n\n## Coordinates\n\n```text\ngroupId:    me.croabeast\nartifactId: PrismaticAPI\nversion:    1.4.0\n```\n\nAdd the repository that hosts your published artifact, then depend on `me.croabeast:PrismaticAPI:1.4.0`.\n\nIf your plugin calls `PrismaticAPI.adventure()`, keep the Adventure API on your compile classpath and ensure the required Adventure runtime classes are present when the plugin starts.\n\n## Supported Syntax\n\n### Single RGB colors\n\n- `{#ff8800}`\n- `%#ff8800%`\n- `[#ff8800]`\n- `\u003c#ff8800\u003e`\n- `\u0026xff8800`\n- `#ff8800`\n- `\u0026#ff8800`\n\n### Gradients\n\n- `\u003cg:ff0000\u003eHello\u003c/g:0000ff\u003e`\n- `\u003cgradient:ff0000\u003eHello\u003c/gradient:0000ff\u003e`\n- `\u003c#ff0000\u003eHello\u003c/#0000ff\u003e`\n- `\u003c#ff0000:#00ff00:#0000ff\u003eHello\u003c/gradient\u003e`\n\n### Rainbows\n\n- `\u003crainbow:1\u003eHello\u003c/rainbow\u003e`\n- `\u003cr:1\u003eHello\u003c/r\u003e`\n\n### Legacy formatting\n\n- `\u0026a`\n- `\u0026l`\n- `\u0026n`\n- `\u0026r`\n\n### MiniMessage\n\nWhen Adventure MiniMessage is present at runtime, standard MiniMessage tags can be mixed with Prismatic syntax in the same string.\n\n## Formatting Pipeline\n\nPrismaticAPI processes text in this order:\n\n1. MiniMessage, when the Adventure runtime is available.\n2. Prismatic multi-color blocks such as gradients and rainbows.\n3. Single RGB syntaxes.\n4. Legacy Bukkit formatting such as `\u0026a`, `\u0026l` and `\u0026r`.\n\nThis lets MiniMessage and Prismatic tags coexist without forcing Adventure to be present on every runtime.\n\n## API Overview\n\n### `PrismaticAPI.legacy()`\n\n`legacy()` returns `Formatter\u003cString\u003e`, which is always safe to use. It emits Bukkit/Bungee-compatible color-code strings.\n\n```java\nString raw = \"\u003cg:ff0000\u003eHello\u003c/g:0000ff\u003e \u0026lworld\";\nString formatted = PrismaticAPI.legacy().colorize(player, raw);\nplayer.sendMessage(formatted);\n```\n\n### `PrismaticAPI.adventure()`\n\n`adventure()` returns `Formatter\u003cComponent\u003e` and uses the same Prismatic parser to build Adventure components.\n\nAlways guard this call when Adventure is optional:\n\n```java\nif (PrismaticAPI.isAdventureAvailable()) {\n    Component component = PrismaticAPI.adventure().colorize(player, \"\u003c#ff8800\u003ePrismaticAPI\");\n}\n```\n\nIf Adventure is not available and you call `PrismaticAPI.adventure()` anyway, the method throws `IllegalStateException` with a controlled error message instead of crashing with `NoClassDefFoundError`.\n\n### Top-level compatibility methods\n\nThe classic entry points still work:\n\n```java\nString formatted = PrismaticAPI.colorize(player, \"\u003crainbow:1\u003eChromatic\u003c/rainbow\u003e\");\nString gradient = PrismaticAPI.applyGradient(\"Hello\", Color.RED, Color.BLUE, false);\n```\n\nThese methods delegate to the `legacy()` facade.\n\n## Important Behavior Notes\n\n### `colorize(String)` is conservative\n\n`PrismaticAPI.colorize(String)` and `PrismaticAPI.legacy().colorize(String)` call the formatter without a `Player` context.\n\nThat means PrismaticAPI cannot know whether the receiver supports hex colors, so it falls back to legacy-safe output.\n\nIf you want player-aware RGB preservation, call:\n\n```java\nString formatted = PrismaticAPI.legacy().colorize(player, raw);\n```\n\nIf you want exact RGB output without a player capability check, use the explicit color methods with `legacy = false`:\n\n```java\nString solid = PrismaticAPI.legacy().applyColor(new Color(255, 136, 0), \"Hello\", false);\nString gradient = PrismaticAPI.legacy().applyGradient(\"Hello\", Color.RED, Color.BLUE, false);\nString rainbow = PrismaticAPI.legacy().applyRainbow(\"Hello\", 1.0f, false);\n```\n\n### Adventure is optional\n\nPrismaticAPI can run perfectly fine without Adventure on the classpath as long as you stay on `legacy()` or the compatibility methods.\n\n`PrismaticAPI.adventure()` requires these classes at runtime:\n\n- `net.kyori.adventure.text.Component`\n- `net.kyori.adventure.text.minimessage.MiniMessage`\n- `net.kyori.adventure.text.minimessage.tag.resolver.TagResolver`\n- `net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer`\n\n### MiniMessage support is shared\n\nBoth facades use the same parsing pipeline. If MiniMessage is available:\n\n- standard MiniMessage tags are deserialized first\n- Prismatic gradients and rainbows are preserved safely during MiniMessage parsing\n- output is downsampled when the target must remain legacy-safe\n\nIf MiniMessage is not available, Prismatic-specific formatting and legacy color codes still work normally.\n\n## Migration From 1.3.x\n\n### Before\n\n```java\nString legacy = PrismaticAPI.colorize(player, raw);\nRichText text = PrismaticAPI.colorizeText(player, raw);\nComponent component = text.component();\n```\n\n### After\n\n```java\nString legacy = PrismaticAPI.colorize(player, raw);\n\nif (PrismaticAPI.isAdventureAvailable()) {\n    Component component = PrismaticAPI.adventure().colorize(player, raw);\n}\n```\n\nMigration summary:\n\n- Replace `RichText` usage with `PrismaticAPI.adventure()`.\n- Replace `colorizeText(...)` with `PrismaticAPI.adventure().colorize(...)`.\n- Replace `applyColorText(...)`, `applyGradientText(...)` and `applyRainbowText(...)` with the corresponding `adventure()` methods.\n- Keep existing legacy string code unchanged if you only need Bukkit-style strings.\n\n## Useful Utility Methods\n\nBoth facades expose the same helper methods:\n\n- `fromString(...)`\n- `stripBukkit(...)`\n- `stripSpecial(...)`\n- `stripRGB(...)`\n- `stripAll(...)`\n- `startsWithColor(...)`\n- `getStartColor(...)`\n- `getEndColor(...)`\n\nThese methods are useful for inspecting or cleaning already-formatted strings without duplicating parsing logic in downstream plugins.\n\n## Local Development\n\nThis project expects the `VNC` project to exist either:\n\n- next to this repository as `../VNC`\n- or inside this repository as `VNC`\n\nThe build compiles the sibling `VNC` jar before compiling PrismaticAPI.\n\n## Build\n\n```bash\n./gradlew jar\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcroabeast%2Fprismaticapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcroabeast%2Fprismaticapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcroabeast%2Fprismaticapi/lists"}