Tune transparency scale impact on luminance scaling #98

Merged
zach merged 3 commits from fix/transparency-luminance-scaling into main 2026-05-24 22:37:04 +02:00
Owner

Addresses #97 by increasing the floor and decreasing the ceiling for the offset value used for brightening darker colors in dark mode and darkening brighter colors in light mode. This tones down aggressiveness and doesn't brighten colors as much at lower transparency.base values, while also increasing effectiveness at values closer to opaque where before it would set the offset to 0 when the bar was set to opaque.

Not extensively tested, especially not light mode color schemes. It still heavily alters the colors but from my testing this alteration is definitely necessary for readability and general aesthetics. There's an argument to be made to possibly disable/alter the offset calculation based on if a preset is selected/automatic scheme generation is turned on. Let me know your thoughts after testing.

If you want to test what happens when you disable this method without breaking the whole shell, you can edit the method like this:

	function alterColor(c: color, a: real, layer: int): color {
		const initLuminance = getLuminance(c);
		const luminance = Math.max(initLuminance, 0.001);

		const offset = (!light || layer == 1 ? 1 : -layer / 2) * (light ? 0.2 : 0.3) * (0.2 + 0.3 * (1 - transparency.base)) * (1 + wallLuminance * (light ? (layer == 1 ? 3 : 1) : 2.5));

		// const r = Math.max(0, Math.min(1, c.r * scale));
		// const g = Math.max(0, Math.min(1, c.g * scale));
		// const b = Math.max(0, Math.min(1, c.b * scale));
		const r = c.r;
		const g = c.g;
		const b = c.b;

		return Qt.rgba(r, g, b, a);
	}

You'll find that generally surface containers are darker than surface layers. This is obviously subjective, but IMO containers should be brighter and have an "elevated" look.

Addresses #97 by increasing the floor and decreasing the ceiling for the offset value used for brightening darker colors in dark mode and darkening brighter colors in light mode. This tones down aggressiveness and doesn't brighten colors as much at lower `transparency.base` values, while also increasing effectiveness at values closer to opaque where before it would set the offset to 0 when the bar was set to opaque. Not extensively tested, especially not light mode color schemes. It still heavily alters the colors but from my testing this alteration is definitely necessary for readability and general aesthetics. There's an argument to be made to possibly disable/alter the offset calculation based on if a preset is selected/automatic scheme generation is turned on. Let me know your thoughts after testing. If you want to test what happens when you disable this method without breaking the whole shell, you can edit the method like this: ```qml function alterColor(c: color, a: real, layer: int): color { const initLuminance = getLuminance(c); const luminance = Math.max(initLuminance, 0.001); const offset = (!light || layer == 1 ? 1 : -layer / 2) * (light ? 0.2 : 0.3) * (0.2 + 0.3 * (1 - transparency.base)) * (1 + wallLuminance * (light ? (layer == 1 ? 3 : 1) : 2.5)); // const r = Math.max(0, Math.min(1, c.r * scale)); // const g = Math.max(0, Math.min(1, c.g * scale)); // const b = Math.max(0, Math.min(1, c.b * scale)); const r = c.r; const g = c.g; const b = c.b; return Qt.rgba(r, g, b, a); } ``` You'll find that generally surface containers are darker than surface layers. This is obviously subjective, but IMO **containers** should be brighter and have an "elevated" look.
zach added 1 commit 2026-05-24 11:54:24 +02:00
Increased floor and decreased ceiling of offset for brightening darker colors in dark mode/darkening brighter colors in light mode
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 13s
Python / lint-format (pull_request) Successful in 28s
Python / test (pull_request) Successful in 43s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m45s
ba9926af18
zach requested review from AramJonghu 2026-05-24 11:54:24 +02:00
zach requested review from Inorishio 2026-05-24 11:54:24 +02:00
AramJonghu approved these changes 2026-05-24 14:03:49 +02:00
AramJonghu left a comment
Collaborator

Resolved in my book. Inspected the difference as well.

Resolved in my book. Inspected the difference as well.
AramJonghu added 1 commit 2026-05-24 18:53:40 +02:00
Merge branch 'main' into fix/transparency-luminance-scaling
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 12s
Python / lint-format (pull_request) Successful in 23s
Python / test (pull_request) Successful in 51s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m47s
6533533936
zach added 1 commit 2026-05-24 22:36:53 +02:00
Merge branch 'main' into fix/transparency-luminance-scaling
Lint & Format (JS/TS) / lint-format (pull_request) Successful in 12s
Python / lint-format (pull_request) Successful in 26s
Python / test (pull_request) Successful in 42s
Lint & Format (Rust) / lint-format (pull_request) Successful in 1m45s
184ab20d11
zach merged commit b4020438f9 into main 2026-05-24 22:37:04 +02:00
Sign in to join this conversation.