[Nexus 4 General] azrash:
This what my script looks like. I put it in /data/local/userinit.d so that it'll survive between nightlies update.

you can run the last part of the script, in terminal or script manager and it'll show the current colour tweak. So if your script is running properly, you should see the corresponding values there.

This script is compatible with hellscore, I am using m+ interchangeably with hellscore.

#!/system/bin/sh

#Setting rgb
color_r=255
color_g=255
color_b=255
echo "$color_r $color_g $color_b" > /sys/devices/platform/kcal_ctrl.0/kcal
echo 1 > /sys/devices/platform/kcal_ctrl.0/kcal_ctrl

#Setting gamma
g_white=84 #Whitepoint, LG=0x72, GOOG=0x40,40,20 Low values=extreme whites, risk of blown out highlights
g_mids=42
g_black=118 #Blackpoint, LG=0x76, GOOG=0x76,76,74 Low values=cut out, banding in the shadows
g_unknown1=0
g_contrast=22 #Contrast, LG=0x00, GOOG=0x00,00,1F
g_brightness=6 #Brightness, LG=0x00, GOOG=0x00,00,10
g_saturation=74 #Saturation, LG=0x50, GOOG=0x30,30,50
g_greys=48
g_unknown2=2

#Tweak red gamma values here if needed
gr_white=`expr $g_white + 0`
gr_mids=`expr $g_mids + 0`
gr_black=`expr $g_black + 0`
gr_unknown1=`expr $g_unknown1 + 0`
gr_contrast=`expr $g_contrast + 0`
gr_brightness=`expr $g_brightness + 0`
gr_saturation=`expr $g_saturation + 0`
gr_greys=`expr $g_greys + 0`
gr_unknown2=`expr $g_unknown2 + 0`
gr_cksummotley=`expr $gr_white + $gr_mids + $gr_black + $gr_unknown1 + $gr_contrast + $gr_brightness + $gr_saturation + $gr_greys + $gr_unknown2`

#Tweak green gamma values here if needed
gg_white=`expr $g_white + 0`
gg_mids=`expr $g_mids + 0`
gg_black=`expr $g_black + 0`
gg_unknown1=`expr $g_unknown1 + 0`
gg_contrast=`expr $g_contrast + 0`
gg_brightness=`expr $g_brightness + 0`
gg_saturation=`expr $g_saturation + 1`
gg_greys=`expr $g_greys + 0`
gg_unknown2=`expr $g_unknown2 + 0`
gg_cksummotley=`expr $gg_white + $gg_mids + $gg_black + $gg_unknown1 + $gg_contrast + $gg_brightness + $gg_saturation + $gg_greys + $gg_unknown2`

#Tweak blue gamma values here if needed
gb_white=`expr $g_white + 0`
gb_mids=`expr $g_mids + 0`
gb_black=`expr $g_black + 0`
gb_unknown1=`expr $g_unknown1 + 0`
gb_contrast=`expr $g_contrast + 0`
gb_brightness=`expr $g_brightness + 0`
gb_saturation=`expr $g_saturation + 1`
gb_greys=`expr $g_greys + 0`
gb_unknown2=`expr $g_unknown2 + 0`
gb_cksummotley=`expr $gb_white + $gb_mids + $gb_black + $gb_unknown1 + $gb_contrast + $gb_brightness + $gb_saturation + $gb_greys + $gb_unknown2`

echo "$gr_cksummotley $gr_white $gr_mids $gr_black $gr_unknown1 $gr_contrast $gr_brightness $gr_saturation $gr_greys $gr_unknown2" > /sys/devices/platform/mipi_lgit.1537/kgamma_red
echo "$gg_cksummotley $gg_white $gg_mids $gg_black $gg_unknown1 $gg_contrast $gg_brightness $gg_saturation $gg_greys $gg_unknown2" > /sys/devices/platform/mipi_lgit.1537/kgamma_green
echo "$gb_cksummotley $gb_white $gb_mids $gb_black $gb_unknown1 $gb_contrast $gb_brightness $gb_saturation $gb_greys $gb_unknown2" > /sys/devices/platform/mipi_lgit.1537/kgamma_blue

# Show the current configuration and the checksum
echo "Verify that the values are written correctly..\n"
echo "RGB values:"
cat /sys/devices/platform/kcal_ctrl.0/kcal
echo "\nRed gamma values:"
cat /sys/devices/platform/mipi_lgit.1537/kgamma_red
echo "\nGreen gamma values:"
cat /sys/devices/platform/mipi_lgit.1537/kgamma_green
echo "\nBlue gamma values:"
cat /sys/devices/platform/mipi_lgit.1537/kgamma_blue
echo ""

#values tweaked by _motley
#script by jazzboyrules