Coloring Pixels

Coloring Pixels

Not enough ratings
How to Enable Color Hints
By Dymino
Have you ever tried coloring one of those images that are basically just a pixelated picture and wished you could see where the last few pixels of your selected color are? If so, then highlighting the pixels could be quite useful for you.
Coloring Pixels doesn't have an option to highlight the selected color so in this guide I will show you how to hack the game to add that functionality.
2
   
Award
Favorite
Favorited
Unfavorite
Introduction
I have often found not being able to see the color that I have selected annoying. Sometimes I would spend weeks on a single image because I'm searching around for the last pixels I'm missing on a certain color. This might just be because of the way I play, I try to fully complete one color at a time, but I feel like this is more fun for me and I feel like being able to see the pixels of the color you have selected just makes everything nicer and reduces the need to search around, especially on those images that are basically just pixelated photos and so have stray pixels everywhere.

I first came up with the idea of hacking the game because recently I have been making my own games. I was thinking of how this feature would be so easy to implement if I could just access the scripts of the game and so I looked around online and found a way to decompile the C# scripts in the game files and edit the code. I successfully managed to implement the feature and so far it's working great. I've decided to put together this guide in case anyone else also wants to add this feature.

This guide requires dnSpy but I will walk through how to get that.
Setting up dnSpy
Coloring Pixels is made using the Unity game engine which is nice for me as I have experience coding using that. Scripts in Unity are written using C# and are compiled into .dll files in the final build. In order to modify the game's code you will first need to decompile the scripts in order to edit them. We will do this using a decompiler called dnSpy.

Downloading dnSpy
First go to this website[github.com] and you should see something like this:
Download whatever build is correct for your OS. For Windows 11 users like me you would be downloading the file called dnSpy-net-win64[github.com].
When the files have downloaded, right click the .zip file and press the Extract All button like this:

Extract the files and open the folder. When you open the folder you should see an application called dnSpy.exe like the one highlighted in blue below, run it.
You should now have dnSpy open. It should look something like this:

Now we just need to find the Coloring Pixels files and open them up.

Finding the Coloring Pixels Files
First, in dnSpy go to File > Open or press Ctrl+O. Then navigate to this folder:
C:\Program Files (x86)\Steam\steamapps\common\Coloring Pixels\ColoringPixels_Data\Managed
You can see how to get there with the below image:

Once you are here, find the file named 'Assembly-CSharp.dll'. This file contains all of the scripts for the game. Press open to import it to dnSpy.
Hacking the Game
From here, go to Assembly-CSharp > Assembly-CSharp.dll > - like in the image below. This file contains the script in the game which we will be editing.

First, find the class called ClickTest and go to the method called UpdateGrayscale() like in the image below. This function was an assistance feature originally used to make all already filled in pixels grayscaled for all colors except your currently selected one whenever you switch but because it is called whenever you switch colors and its functionality is pretty similar to what we want, we can easily repurpose it.

Right click anywhere in the editor and you should get the option to select 'Edit Method (C#)...' or you can just press Ctrl+Shift+E and a window should pop up allowing you to edit the method. Next, just delete all code already there and copy and paste all the code down below into the window.
using System; using UnityEngine; using UnityEngine.Tilemaps; using UnityEngine.UI; // Token: 0x02000015 RID: 21 public partial class ClickTest : MonoBehaviour { // Token: 0x06000054 RID: 84 public void UpdateGrayscale() { for (int i = 0; i < this.xMax; i++) { for (int j = 0; j < this.yMax; j++) { if (this.savedGridValues[i, j] == -1) { Color color; if (this.selectedColourID == this.mainGridValues[i, j]) { color = Color.grey; } else { color = Color.white; } Vector3Int position = new Vector3Int(i, j, 0); this.tilemap.SetTileFlags(position, TileFlags.None); this.tilemap.SetColor(position, color); } if (this.savedGridValues[i, j] > 0 && this.crossLevel.grayscale) { Color color2 = this.crossLevel.colours[this.savedGridValues[i, j] - 1]; if (this.selectedColourID != this.savedGridValues[i, j]) { color2 = color2.CheckGrayScale(this.crossLevel); } color2.r = this.Clamp(color2.r, 0.2f, 1f); color2.g = this.Clamp(color2.g, 0.2f, 1f); color2.b = this.Clamp(color2.b, 0.2f, 1f); if (this.crossLevel.highContrast >= 2 && this.savedGridValues[i, j] != this.mainGridValues[i, j]) { color2 = Color.white; } Vector3Int position2 = new Vector3Int(i, j, 0); this.tilemap.SetTileFlags(position2, TileFlags.None); this.tilemap.SetColor(position2, color2); } } } } }
Press compile to finish editing and then go to File > Save All... or press Ctrl+Shift+S and press OK to save your work. If you don't do this it won't work (obviously).

This will make it so that every pixel of the selected color will be highlighted as long as it has not been colored incorrectly. If instead you want to make it so that every pixel is highlighted regardless of whether or not it is colored correctly, paste the code here[pastebin.com] instead of the code above.
Conclusion
Congratulations, you are now a hacker! If you go open the game now you should see all pixels of your selected color that haven't been filled in are colored gray like this:

If you want to reverse this then it will be fixed just by uninstalling and reinstalling the game but if you don't want to do that you could just keep a backup of the method you replaced and if you want to reverse back then just use dnSpy to change the methods back to their original state.
Hope you enjoy!

Edit: It seems like whenever the game is updated, the edited code gets reset. That's not too much of a problem though as the game only gets updated about once a month and changing the code back is as easy as just copying and posting the code above. It's not perfect but it's a small price to pay. As far as I know, this won't be able to be fixed unless the developers put this code into the main build of the game.
21 Comments
XoeSara 22 Jun @ 7:24am 
:steamthumbsup:
Noah 21 Jun @ 5:49am 
this [pastebin.com] should fix the desaturation
XoeSara 20 Jun @ 8:20pm 
desaturates the colors for some reason. I have greyscale disabled (doesn't work anyway)
KooRowMe 18 Jun @ 4:21am 
yup it works tyvm
KooRowMe 18 Jun @ 4:20am 
let me try
Noah 17 Jun @ 8:56pm 
try this one [pub.microbin.eu], dunno why paste bin says its private when i set it to public
KooRowMe 17 Jun @ 8:36pm 
I cant access the latest version you posted cause its a private paste
Noah 15 Jun @ 6:22pm 
Hi! I’m not sure if you’ve made a third version yet, but I went ahead and combined elements from both v1 and v2 that you posted here. I noticed that in v1, even though it didn't highlight the selected colour for pixels that were incorrectly coloured, it maintained high contrast so incorrect colourings didn’t get highlighted, making mistakes less visible. Meanwhile, v2 highlights all pixels of the selected colour, even those that were coloured incorrectly, but it loses the high contrast feature.

I’ve created a version here [pastebin.com] that keeps the high contrast and highlights every pixel of the selected colour, regardless of correctness.
iFx || Ruri- 7 May @ 3:12pm 
yes. now it works. thank you so much for the fix. before now I either saved the dark colors for last or used the eraser afterwards
Dymino  [author] 7 May @ 8:53am 
I think I know what you mean. I hadn't noticed because I was using the main code I had put up which doesn't change pixels colored incorrectly, but after trying out the alternate code I provided I noticed the problem I think you're talking about. I think the reason this was happening was because the game normally 'clamps' a color if it is in the wrong place to not make it too dark. I fixed the problem by clamping the colors in the alternate code which I hadn't done before. I updated the guide with a new link to the updated code.You can also access it here [pastebin.com].