Skip to content

Add default colour for challenge description and reward text#418

Merged
tastybento merged 1 commit into
developfrom
feat/340-default-text-color
Jul 11, 2026
Merged

Add default colour for challenge description and reward text#418
tastybento merged 1 commit into
developfrom
feat/340-default-text-color

Conversation

@tastybento

Copy link
Copy Markdown
Member

Replaces the closed #340 (see the closing note there for why the original couldn't be merged — MiniMessage migration broke its legacy-colour wrapping and &b prefixing).

This keeps the genuinely useful idea from that PR — a default text colour so admins don't have to prefix every challenge's description/reward text with the same colour code — reimplemented to work with the current pipeline.

What it adds

Two new gui-settings, both empty by default (no behaviour change):

  • description-color — colour applied to each line of a challenge's own description text.
  • reward-text-color — colour applied to each line of a challenge's own first-time and repeat reward text.

Utils.applyDefaultColor(text, color) prefixes every line (so multi-line text stays coloured on each lore line) and runs before Util.translateColorCodes, so it uses the same & / hex codes (e.g. &b, &#55FFFF) as the challenge text. A colour written in the text itself still overrides the default (a later code wins). Only the challenge's own data-field text is affected — per-challenge locale overrides are left alone (admins colour those directly).

Deliberately left out

The lore-length line-wrapping half of #340 is not included:

  • It used WordUtils.wrap + ChatColor.getLastColors, which miscount/mangle MiniMessage tags.
  • Its default (25) reintroduced the space-less-language (CJK) wrapping problems it was removed for.
  • The panel already wraps reward text via wrapToWidth().

Tests

UtilsTest covers applyDefaultColor: blank/null colour → unchanged, empty/null text → unchanged, single-line and multi-line prefixing, blank-line preservation, and hex colours. Full suite green (508 tests).

Closes the loop on #340.

🤖 Generated with Claude Code

Reimplements the useful part of the closed PR #340 in a way that fits the
current pipeline. Setting a default colour saves admins from prefixing
every challenge's description/reward text with the same colour code.

Two new gui-settings, both empty by default (no change):
- description-color: colour applied to each line of a challenge's own
  description text.
- reward-text-color: colour applied to each line of a challenge's own
  first-time and repeat reward text.

The colour is applied per line (so multi-line text stays coloured on
every lore line) before Util.translateColorCodes, so it uses the same
'&' / hex codes as the challenge text itself; a colour written in the
text still overrides the default. Only the challenge's own data-field
text is affected, not per-challenge locale overrides.

The lore-length line-wrapping half of #340 is intentionally left out: it
was built on legacy ChatColor wrapping incompatible with MiniMessage, its
default reintroduced the space-less-language issues it was removed for,
and the panel already wraps reward text via wrapToWidth().

Adds Utils.applyDefaultColor with JUnit coverage (blank/empty handling,
single/multi-line, blank-line preservation, hex colours).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NKxodNE4h3TsSHMqDEeC8v
@sonarqubecloud

Copy link
Copy Markdown

@tastybento tastybento merged commit bb27ccc into develop Jul 11, 2026
3 checks passed
@tastybento tastybento deleted the feat/340-default-text-color branch July 11, 2026 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant