GithubHelp home page GithubHelp logo

Implement color picker about cosc-481w HOT 3 CLOSED

Daltz333 avatar Daltz333 commented on June 30, 2024
Implement color picker

from cosc-481w.

Comments (3)

leemo3 avatar leemo3 commented on June 30, 2024

implement color picker in Python for 100 different shades

def rgb_to_hex(red, green, blue):
return "#{:02X}{:02X}{:02X}".format(red, green, blue)

Generate 100 different color shades

colors = []
for i in range(100):
# Vary the red, green, and blue components proportionally
red = int(255 * i / 100)
green = int(255 * i / 100)
blue = int(255 * i / 100)
hex_color = rgb_to_hex(red, green, blue)
colors.append(hex_color)

Print the list of 100 different color shades

for color in colors:
print(color)

from cosc-481w.

leemo3 avatar leemo3 commented on June 30, 2024

function rgbToHex(red, green, blue) {
return #${red.toString(16).padStart(2, '0')}${green.toString(16).padStart(2, '0')}${blue.toString(16).padStart(2, '0')};
}

// Generate 100 different color shades
const colors = [];
for (let i = 0; i < 100; i++) {
// Vary the red, green, and blue components independently
const red = Math.floor((255 * i) / 100);
const green = Math.floor((255 * i) / 100);
const blue = Math.floor((255 * i) / 100);
const hexColor = rgbToHex(red, green, blue);
colors.push(hexColor);
}

// Print the list of 100 different color shades
for (const color of colors) {
console.log(color);
}

from cosc-481w.

Daltz333 avatar Daltz333 commented on June 30, 2024

I pretty much have this implemented in-app.

from cosc-481w.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.