Tone down generated UI surfaces
This commit is contained in:
@@ -5035,6 +5035,9 @@ func _check_panel_texture_path(failures: Array[String], path: String, context: S
|
||||
failures.append("%s should not keep chroma-key green pixels: %s (%d sampled)" % [context, path, green_fringe_samples])
|
||||
if luma_max - luma_min < 0.10:
|
||||
failures.append("%s should contain visible material contrast: %s" % [context, path])
|
||||
var warm_bias := _image_visible_warm_bias(image, 8)
|
||||
if warm_bias > 0.12:
|
||||
failures.append("%s should avoid a dominant yellow UI cast: %s (warm bias %.3f)" % [context, path, warm_bias])
|
||||
|
||||
|
||||
func _check_button_texture_path(failures: Array[String], path: String, context: String) -> void:
|
||||
@@ -5090,6 +5093,25 @@ func _check_button_texture_path(failures: Array[String], path: String, context:
|
||||
failures.append("%s should not keep chroma-key green pixels: %s (%d sampled)" % [context, path, green_fringe_samples])
|
||||
if luma_max - luma_min < 0.08:
|
||||
failures.append("%s should contain visible material contrast: %s" % [context, path])
|
||||
var warm_bias := _image_visible_warm_bias(image, 8)
|
||||
if warm_bias > 0.12:
|
||||
failures.append("%s should avoid a dominant yellow UI cast: %s (warm bias %.3f)" % [context, path, warm_bias])
|
||||
|
||||
|
||||
func _image_visible_warm_bias(image: Image, sample_step: int) -> float:
|
||||
var total_bias := 0.0
|
||||
var visible_samples := 0
|
||||
var step := maxi(1, sample_step)
|
||||
for y in range(0, image.get_height(), step):
|
||||
for x in range(0, image.get_width(), step):
|
||||
var pixel := image.get_pixel(x, y)
|
||||
if pixel.a <= 0.05:
|
||||
continue
|
||||
total_bias += maxf(0.0, ((pixel.r + pixel.g) * 0.5) - pixel.b)
|
||||
visible_samples += 1
|
||||
if visible_samples <= 0:
|
||||
return 0.0
|
||||
return total_bias / float(visible_samples)
|
||||
|
||||
|
||||
func _check_tile_marker_texture_path(failures: Array[String], path: String, context: String) -> void:
|
||||
|
||||
Reference in New Issue
Block a user