Warning! It seems that you are using Dodona within another webpage, so not everything may work properly. Let your teacher know so that he can solve the problem by adjusting a setting in the learning environment. In the meantime, you can click this link to open Dodona in a new window.
Warning! The page was not fully loaded, probably because of a network issue. It could be that not all functionalities work as expected. Please try reloading the page.
Kleurenblindheid
Sign in to test your solution.
def rgbToLineair(kleur):
tempR = kleur[0] / 255.0
tempG = kleur[1] / 255.0
tempB = kleur[2] / 255.0
return (tempR / 12.92 if tempR < 0.0405 else ((tempR + 0.055) / 1.055) ** 2.4, tempG / 12.92 if tempG < 0.0405 else ((tempG + 0.055) / 1.055) ** 2.4, tempB / 12.92 if tempB < 0.0405 else ((tempB + 0.055) / 1.055) ** 2.4)
def lineairToRgb(kleur):
tempR = kleur[0] * 12.92 if kleur[0] <= 0.0031308 else 1.055 * (kleur[0] ** (1.0 / 2.4)) - 0.055
tempG = kleur[1] * 12.92 if kleur[1] <= 0.0031308 else 1.055 * (kleur[1] ** (1.0 / 2.4)) - 0.055
tempB = kleur[2] * 12.92 if kleur[2] <= 0.0031308 else 1.055 * (kleur[2] ** (1.0 / 2.4)) - 0.055
return (round(max(0.0, min(1.0, tempR)) * 255), round(max(0.0, min(1.0, tempG)) * 255), round(max(0.0, min(1.0, tempB)) * 255))