Skip to content

Conversation

@fank
Copy link
Member

@fank fank commented Feb 8, 2026

Summary

  • colorArrayToHex assumed color values were 0-1 floats and multiplied by 255, but grad_meh exports colors as 0-255 integers (e.g. [128, 121, 118])
  • Any value > 1 was clamped to 255, producing ffffff (white) for every building
  • Now auto-detects the range: values > 1 are treated as 0-255 directly, otherwise as 0-1 floats
  • Supersedes fix: darken building colors for better visibility #142 — fixes the root cause instead of darkening white in the style
image image image

Test plan

  • Existing 0-1 float tests still pass
  • New tests for grad_meh 0-255 values ([128,121,118]807976)
  • Re-import a map and verify buildings render with correct in-game colors

colorArrayToHex assumed color values were 0-1 floats and multiplied by
255, but grad_meh exports use 0-255 integers. Any value > 1 was clamped
to 255, making all buildings white (ffffff). Now auto-detects the range
and handles both formats correctly.
@gemini-code-assist
Copy link

Summary of Changes

Hello @fank, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves an issue where house colors were incorrectly rendered due to a mismatch in expected color value ranges. Previously, the system assumed 0-1 float values, leading to incorrect conversions for 0-255 integer inputs. The colorArrayToHex function has been updated to automatically detect the appropriate range, ensuring accurate and consistent color representation for buildings from various sources.

Highlights

  • Dynamic Color Range Detection: The colorArrayToHex function now intelligently detects whether input color values are in the 0-1 float range (e.g., Arma config) or the 0-255 integer range (e.g., grad_meh exports), applying the correct conversion logic.
  • Refactored Clamping Logic: The clamp255 function has been renamed to clampInt and its implementation adjusted to directly clamp integer values, supporting the new dynamic range detection.
  • Enhanced Test Coverage: New unit tests have been added for colorArrayToHex to specifically cover the 0-255 integer color range, and existing tests for the clamping function have been updated to reflect its new behavior.
Changelog
  • internal/maptool/vector.go
    • Modified colorArrayToHex to dynamically handle both 0-1 float and 0-255 integer color input ranges.
    • Renamed clamp255 to clampInt and adjusted its logic to clamp integer values directly.
  • internal/maptool/vector_test.go
    • Added new test cases to TestColorArrayToHex to validate the conversion of 0-255 integer color values.
    • Updated TestClampInt (formerly TestClamp255) with test cases appropriate for its new integer clamping behavior.
Activity
  • No specific review comments or activity beyond the initial pull request creation have been recorded yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Feb 8, 2026

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/OCAP2/web/internal/maptool 14.94% (+0.07%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/OCAP2/web/internal/maptool/vector.go 7.58% (+0.35%) 924 (+10) 70 (+4) 854 (+6) 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/OCAP2/web/internal/maptool/vector_test.go

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly fixes an issue with house color conversion by introducing logic to handle both 0-1 float and 0-255 integer color value ranges. The implementation auto-detects the range based on color component values, which is a robust approach for handling data from different sources. The changes are well-tested, with new test cases covering the 0-255 integer range and existing tests for the 0-1 float range still passing. The refactoring of the clamping function improves code clarity. The fix is solid and directly addresses the described problem.

@fank fank merged commit 4b6f7cc into main Feb 8, 2026
2 checks passed
@fank fank deleted the fix/house-color-conversion branch February 8, 2026 12:56
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.

1 participant