color_rgb.py

Created by marius-layan

Created on March 31, 2023

669 Bytes

Voici un petit programme qui permet de retrouver un couleur en rgb.

il est possible de modifier le rouge, vert et bleu avec ses touches:

rouge: SHIFT / EXP … vert: ALPHA / LN … bleu: XNT / LOG


from kandinsky import *
from random import *
from time import *
from ion import *
r,g,b=255,255,255
def rgb():
  fill_rect(0,0,320,222,(r,g,b))
  draw_string("r: "+str(r),0,0,(255-r,255-g,255-b),(r,g,b))
  draw_string("g: "+str(g),0,20,(255-r,255-g,255-b),(r,g,b))
  draw_string("b: "+str(b),0,43,(255-r,255-g,255-b),(r,g,b))
rgb()
while True:
  if keydown(KEY_SHIFT) and r<255:
    r+=1
    rgb()
  if keydown(KEY_EXP) and 0<r:
    r-=1
    rgb()
  if keydown(KEY_ALPHA) and g<255:
    g+=1
    rgb()
  if keydown(KEY_LN) and 0<g:
    g-=1
    rgb()
  if keydown(KEY_XNT) and b<255:
    b+=1
    rgb()
  if keydown(KEY_LOG) and 0<b:
    b-=1
    rgb()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.