Skip to content

Accessibility and Sounds

ssbaxys edited this page Oct 26, 2026 · 1 revision

Color blindness, high contrast, text scale and UI sounds.

Accessibility (a11y)

Each root has its own settings: root.accessibility().

root.accessibility()
        .colorVision(ColorVision.DEUTERANOPIA)                          // correction (daltonize)
        .colorVision(ColorVision.PROTANOPIA, Accessibility.ColorMode.SIMULATE) // how a person sees it
        .textScale(1.25f)          // all font sizes × 1.25 (0.5–3)
        .reducedMotion(true)       // style and theme transitions become instant
        .focusAlwaysVisible(true)  // a visible focus ring on top of everything
        .narration(true);          // focus is narrated via Platform.narrate

The color filter applies to the whole frame at the Canvas level (setColorFilter): fills, gradients, borders, shadows and text; textures and items are not filtered. Your own filter: extraFilter(ColorFilter), for example ColorFilter.grayscale(). The narration text is UiElement.accessibleLabel(); buttons, checkboxes and labels take it from their text, set your own with setAccessibleLabel(...).

High-contrast themes: AccessibleThemes.highContrastDark(), highContrastLight() or AccessibleThemes.highContrast(theme): black/white background, text at least 7:1, accent at least 4.5:1, 2-pixel borders and a visible focus outline. There are also filterColors(theme, filter) and reducedMotion(theme).

UI sounds (sound)

The HOVER_SOUND and CLICK_SOUND style keys (hover-sound, click-sound in CSS) take a UiSound value:

.button { hover-sound: minecraft:block.note_block.hat 0.12 1.6; click-sound: minecraft:ui.button.click 0.25 1; }
.toggle { click-sound: none; }

The hover sound plays only when the pointer enters an enabled element, at most once every 70 ms (root.setHoverSoundInterval(seconds)). Without click-sound, buttons click like in the game. Ready-made sets: SoundTheme.VANILLA, SOFT, RETRO, NONE; SoundTheme.custom(name, hover, click), scaled(volume). SoundTheme.RETRO.applyTo(theme, "nav") assigns sounds to buttons, toggles, checkboxes, menu items and the listed classes.


← Config Screen · English home · Extending →

Clone this wiki locally