Skip to content

feat(cinbase): make the composition-layer colors configurable (#902) - #1032

Open
asdf80730 wants to merge 1 commit into
EasyIME:masterfrom
asdf80730:pr/ui-colors-902
Open

asdf80730 wants to merge 1 commit into
EasyIME:masterfrom
asdf80730:pr/ui-colors-902

Conversation

@asdf80730

Copy link
Copy Markdown
Contributor

feat(cinbase): make the composition-layer colors configurable (#902)

Fixes #902

The two text layers were painted from the system palette only:
PIMETextService/PIMEClient.cpp fed CandidateWindow and MessageWindow the
GetSysColor answers, and the selection key was the literal RGB(0, 0, 255),
so a 大易 or 嘸蝦米 user on a dark host background got a low-contrast 字根 row
with no way to change it. Three integer settings ride the existing
customizeUI reply instead, with 0 meaning "follow the system palette", so
every shipped config keeps its present rendering.

  • PIMETextService/UIColors.h is the new mapping: uiColorValue reads one
    reply key and falls back to the 0 sentinel, and updateUI hands the values
    to the service — text, background and selection key for the candidate window,
    text and background for the message window — beside the existing font values.
  • python/cinbase/config.py declares candTextColor, windowBackgroundColor
    and selKeyColor with the 0 default, and sanitize keeps a configured 24-bit
    int (a numeric string included) while repairing an absent, non-integer,
    negative or past-range value to 0.
  • python/cinbase/__init__.py puts the three values on the applyConfig reply.
  • python/cinbase/config/config.htm names one control per key, which the
    settings page's existing generic input loop saves without new script, and the
    eight shipped python/input_methods/che*/config/config.json carry the keys so
    a fresh install answers the same numbers as the code defaults.
  • libIME2 gains setTextColor/setBackgroundColor/setSelKeyColor on
    CandidateWindow and setTextColor/setBackgroundColor on MessageWindow;
    a 0 value keeps the old GetSysColor and RGB(0, 0, 255) defaults, so the
    nine cinbase services render identically until a value is set.

Validation:

  • python/python3/python.exe with
    -m unittest discover -s tests -p "test_cinbase_composition_colors.py" on the
    integration tree carrying this diff: Ran 7 tests ... OK — the three defaults
    exist with and without a config.json, an illegal value is repaired to 0, and
    the reply carries the three keys.
  • g++.exe with
    -std=c++17 -O1 -static -I PIMETextService -I json/single_include over
    tests/ui_colors_test.cpp prints ui colors: all assertions passed: a
    missing key, a null, a bool and an out-of-range integer each answer 0, a
    configured 24-bit int and a numeric string each answer that value.
  • The nine cinbase services still answer their candidate, composition and
    message layers on the same tree; only the three new integers differ from the
    palette they used to read.

Fully generated by omp (tensorfold/Qwen3.8-Flash-Next) without human intervention.

@PCMan

PCMan commented Nov 13, 2026

Copy link
Copy Markdown
Member

I'll withhold all new features for now. Let's finalize v2.0 first to get the framework to a stable and robust state. Then we start adding new features on top of v2.0.

(Review comment generated with assistance from Antigravity + Gemini 4 Argon)

asdf80730 added a commit to asdf80730/PIME that referenced this pull request Nov 21, 2026
The maintainer settled the order on 2026-11-13: the framework is brought to a
stable and robust state and tagged, and only then do the feature PRs move. The
`AGENTS.md` hard limit now names that order with the PR numbers on each side --
the withheld `feat(...)` set (EasyIME#1013, EasyIME#1029, EasyIME#1032) against the stabilizing set
(EasyIME#1004 EasyIME#1014 EasyIME#1022 EasyIME#1026 EasyIME#1031 EasyIME#1033 EasyIME#1034 EasyIME#1035 EasyIME#1036 and the two pins) -- and
restates the one-problem-per-PR rule with the rename-or-move-is-its-own-commit
clause that EasyIME#1036 needed.

`docs/agents/cinbase-config.md` counts nine shipped `config.json` where the
earlier text said eight: `chebihua` joined `IME_DIRS` and the `overrides` maps of
`CONFIG_RECORDS`, so the writer now emits nine files and the per-Service trap is
that writer plus one directory.

Implementation generated with AI assistance from omp (Qwen3.8-Flash-Next).
…E#902)

The candidate and message layers painted the system palette only:
CandidateWindow.cpp used GetSysColor(COLOR_WINDOWTEXT)/COLOR_WINDOW and the
selection key the literal RGB(0, 0, 255), so a 大易/嘸蝦米 user on a dark host
background got a low-contrast 字根 row. Three integer settings put those values
on the existing customizeUI reply, with 0 meaning "follow the system palette" so
every shipped config keeps its present rendering.

- PIMETextService/UIColors.h: uiColorValue maps the three reply keys with 0 as
  the sentinel fallback; updateUI feeds the service, which hands text, background
  and selection-key values to the candidate window and text and background to the
  message window, beside the existing font handling.
- python/cinbase/config.py: candTextColor, windowBackgroundColor and selKeyColor
  on CinBaseConfig, sanitized to 24-bit ints with numeric strings accepted, and
  absent, non-integer, negative and past-range values repaired to 0.
- python/cinbase/__init__.py: applyConfig puts the three values on the reply.
- The 功能設定 page names one control per key, and the eight shipped
  config/config.json carry the keys, so a fresh install answers the defaults.
- libIME2: setTextColor/setBackgroundColor/setSelKeyColor on CandidateWindow and
  setTextColor/setBackgroundColor on MessageWindow; a 0 value keeps the old
  GetSysColor/RGB(0, 0, 255) defaults.

Fully generated by omp (tensorfold/Qwen3.8-Flash-Next) without human intervention.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

希望PIME嘸蝦米可以支援設定字根背景顏色

2 participants