gradient6.py

Created by elnix91

Created on February 05, 2025

237 Bytes

Display a gradient color using the function gradient(n). N can be any integer, a it is modulo. Do display a gradient, use the function in a loop and increment n progressively.


def gradiant(n):
  n,p,r,g,b=n%1530,n%1530%255,0,0,0
  if n<255:r,b=255,p
  elif n<510:r,b=255-p,255
  elif n<765:g,b=p,255
  elif n<1020:g,b=255,255-p
  elif n<1275:r,g=p,255
  elif n<1530:r,g=255,255-p
  return (r,g,b)

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.