{"action":"opened","issue":{"url":"https://api.github.com/repos/libgdx/libgdx/issues/3424","labels_url":"https://api.github.com/repos/libgdx/libgdx/issues/3424/labels{/name}","comments_url":"https://api.github.com/repos/libgdx/libgdx/issues/3424/comments","events_url":"https://api.github.com/repos/libgdx/libgdx/issues/3424/events","html_url":"https://github.com/libgdx/libgdx/issues/3424","id":107240790,"number":3424,"title":"Support Immutable Color","user":{"login":"ericnondahl","id":1621682,"avatar_url":"https://avatars.githubusercontent.com/u/1621682?v=3","gravatar_id":"","url":"https://api.github.com/users/ericnondahl","html_url":"https://github.com/ericnondahl","followers_url":"https://api.github.com/users/ericnondahl/followers","following_url":"https://api.github.com/users/ericnondahl/following{/other_user}","gists_url":"https://api.github.com/users/ericnondahl/gists{/gist_id}","starred_url":"https://api.github.com/users/ericnondahl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericnondahl/subscriptions","organizations_url":"https://api.github.com/users/ericnondahl/orgs","repos_url":"https://api.github.com/users/ericnondahl/repos","events_url":"https://api.github.com/users/ericnondahl/events{/privacy}","received_events_url":"https://api.github.com/users/ericnondahl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-18T17:08:04Z","updated_at":"2015-09-18T17:08:04Z","closed_at":null,"body":"We are running into an issue where a static Color stored in the Colors map is being changed - so that the shared Color used across the game changes also. (i.e \"BLACK\" was changed to no longer be black)\r\n\r\nWhile we've fixed the cause of this, it isn't possible currently to make a Color object that enforces this. The `r` `g` `b` values are public, which means there is no easy way to subclass Color to make an \"UnchangeableColor\" class. There are hundreds of direct references to these public variables in the libGDX codebase.\r\n\r\nHere's what i'd propose:\r\n1. Replace the `public float r, g, b, a` with getters and setters.\r\n2. Create an unchangeable Color class that is only set in the constructor and use it for colors like \"BLACK\" and \"RED\" which should never be accidentally changed, and optionally for any unchangable colors that a game wants to add to the Colors map.\r\n\r\nThoughts?"}}