#πŸ”’ How do I input this field..

61 messages Β· Page 1 of 1 (latest)

surreal verge
#

Hi I have a beginner issue. I am using Google collab to run a python script for converting colour. But I have no idea how to key in the color code? Hex is said to be possible but I do not know how to input this.

Text version:

import colour['#735244']

input_colourspace = colour.RGB_COLOURSPACES['ACEScg']
output_colourspace = colour.RGB_COLOURSPACES['sRGB']

colour.matrix_RGB_to_RGB(input_colourspace, output_colourspace, 'CAT02')

radiant shardBOT
#

@surreal verge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

surreal verge
iron glen
#

just import colour

surreal verge
#

where do I key in the colour code then?

#

sorry for the basic question

iron glen
#

no need for apologies

#

There are some examples there. Is that what you're looking for?

surreal verge
#

According to the document I tried: import colour ("#ff0000")

#

but Im still getting a syntax error

proper agate
#

import without the ("#ff0000")

#

just import colour

surreal verge
#

then how is colour defined

proper agate
#

look in the github page

surreal verge
#

its the value I need to convert

proper agate
surreal verge
#

yea I was referring to it

#

thats how I got colour('#f0000")

#

Im trying to key in the color to convert instead of display

proper agate
#

I'm also quite new to python and haven't used the colour module. I can't understand your question

iron glen
surreal verge
#

there is otherwise no instruction I can find on the tool im using

iron glen
#

Where? Can you take a screenshot?

iron glen
#

I am not finding it anywhere.

surreal verge
#

under the second box, 5th line

#

I thought that'd be the answer to my issue..

iron glen
#

That's not an import

surreal verge
#

I see..

proper agate
#

the Color here is a function from themodule colour

surreal verge
#

How do I import a colour then

proper agate
#

the code imported it via from colour import Color

surreal verge
#

I am so confused. How do I import a colour into the tool..

#

do I have to type a second line like color=hex value?

rancid elm
#

yes. you don't import "a color"

#

you import the thing that can create a color, and then create the color in a separate line

surreal verge
#

ok I will try that brb

#

colour=('#ffffff')
import colour
input_colourspace = colour.RGB_COLOURSPACES['ACES2065-1']
output_colourspace = colour.RGB_COLOURSPACES['sRGB']

colour.matrix_RGB_to_RGB(input_colourspace, output_colourspace, 'CAT02')

#

I am getting the error, AttributeError: module 'colour' has no attribute 'RGB_COLOURSPACES'

rancid elm
#

whatever you're using is probably a different module then. what did you install?

iron glen
#

yeah

#

I found it.

#

That's a different module.

#

much more complex than the other

rancid elm
#

the thing you import is not always the same thing you need to pip install. In this case you might even have conflicting modules, so you'd need to uninstall the "colour" module before you install colour-science

surreal verge
#

I see

#

let me try to do that

#

I am still lost hahahaha

#

it did not work

#

I will now proceed to give up and find an online version with a frontend that allows me to just key in colours

#

thank you so much for the help!

radiant shardBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.