Skip to content

Persist and re-apply a chosen skin tone in the grid, recents and search - #263

Merged
Fintasys merged 2 commits into
masterfrom
claude/emoji-picker-user-control-ksleyc
Jul 21, 2026
Merged

Persist and re-apply a chosen skin tone in the grid, recents and search#263
Fintasys merged 2 commits into
masterfrom
claude/emoji-picker-user-control-ksleyc

Conversation

@Fintasys

Copy link
Copy Markdown
Owner

Closes #262

Summary

Adds optional support for remembering a user's skin tone choice and re-applying it for display and selection in the grid, recents and search — controlled entirely through SkinToneConfig. Previously SkinToneConfig only controlled visuals and there was no way to make the grid or recents show a previously selected tone.

What changed

New SkinToneConfig settings

property description default
defaultSkinTone Global skin tone applied to every skin-tone-capable emoji in the grid/recents/search null (base glyph, previous behavior)
skinToneResolver Per-emoji callback String? Function(Emoji) returning the tone to display; falls back to defaultSkinTone when it returns null null

A resolveSkinTone(Emoji) helper resolves the effective tone (resolver takes precedence, then the global default).

SkinToneConfig(
  defaultSkinTone: SkinTone.medium,
  skinToneResolver: (emoji) => myPreferences[emoji.name], // optional per-emoji lookup
)

Display + selection

  • EmojiPickerUtils.applyDisplaySkinTone(emoji, skinToneConfig) returns the toned glyph for display/selection when a tone applies, otherwise the emoji unchanged. hasSkinTone is preserved so the indicator and long-press picker keep working on those cells.
  • The default grid and the search view now apply this for both the rendered cell and the LayerLink key, so tapping a toned cell selects the toned glyph. Recents display the tone too, since recent entries keep hasSkinTone.

Correctness fixes (from the issue's note)

  • applySkinTone now strips any existing skin tone modifier before applying a new one, so re-toning an already toned glyph no longer produces invalid double-modifier sequences (e.g. 👋🏻🏽).
  • The long-press overlay strips the existing tone first, so the "no tone" cell shows the base glyph and re-picking always applies the new tone to the base, not the already-toned glyph.
  • Exposed a public EmojiPickerUtils.removeSkinTone.

Backward compatibility

With no defaultSkinTone/skinToneResolver set, applyDisplaySkinTone returns the base glyph and every code path is unchanged — existing behavior and tests are preserved.

Tests

Added unit tests for applySkinTone on already-toned glyphs, removeSkinTone, SkinToneConfig.resolveSkinTone, and applyDisplaySkinTone (default, disabled, non-toneable, precedence).

🤖 Generated with Claude Code

https://claude.ai/code/session_01EP92uNBmLFz6ckKR8MHueg


Generated by Claude Code

@Fintasys
Fintasys force-pushed the claude/emoji-picker-user-control-ksleyc branch 2 times, most recently from cb49bb2 to 61d9468 Compare July 20, 2026 16:26
Add an opt-in `SkinToneConfig.rememberSkinTone` flag. When enabled, the
tone picked via the long-press picker is persisted to SharedPreferences
and re-applied as the default for skin-tone-capable emoji in the grid,
recents and search on the next launch. Selecting the base glyph clears
the remembered tone.

Also strips an existing tone before re-applying so re-picking a toned
glyph yields a valid single-modifier sequence, and makes the long-press
picker operate on the base glyph. Updates README, CHANGELOG and tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Fintasys
Fintasys force-pushed the claude/emoji-picker-user-control-ksleyc branch from 61d9468 to 549a2f5 Compare July 21, 2026 02:58
- EmojiPickerUtils.removeSkinTone now delegates to the internal
  cached regex instead of recompiling RegExp on every call
- Correct README SkinTone config table: enableSkinTones -> enabled

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Fintasys
Fintasys merged commit 0204d75 into master Jul 21, 2026
1 check passed
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.

Persist and re-apply a chosen skin tone in the grid and recents

1 participant