Hex color in p5js web editor

Hi forum,

Why does this not work in the p5js web editor?

function setup() {
  createCanvas(400, 400);

function draw() {
  let c1 = color('#f92804');

Thanks for the help.

In the future please try to be more specific. Saying it doesn’t work doesn’t tell us much, so try to describe the behavior you expected versus what you’re actually seeing.

Also, try to get into the habit of looking at your JavaScript console. Any errors you get will show up there.

Anyway, take a closer look at this line:

let c1 = color(’#f92804’);

Notice that the apostrophe characters in there are smart quotes instead of the straight up-and-down apostrophe character.

If I change that line to this:

let c1 = color('#f92804');

Then I see a single red rectangle on the screen, which is what I would expect.


hi Leo_Aguiar,
you not posted / PASTED the code in the

</> code tag

so possible the mentioned


problem is not the real problem, just created here at the forum post ?

if you refer to the problem where in p5.js color can be defined
there is a good info at
https://github.com/processing/p5.js/wiki/p5.js-overview#why-cant-i-assign-variables-using-p5-functions-and-variables-before-setup ,
using this i got for example:

hi Kevin,
yes and no!
i show a little gallery what i see here: ( win7 64bit / firefox browser )
about p5js.org editor / and a possible problem with it.
-a- the change works when i was not login
-b- now i login and same code NOT work:
can not use global: ( if you not use the

new p5();

-d- officially must use setup() for it

what you make out of that? what i do wrong?

Would you mind sharing your sketch link? I’ve tried to duplicate your code in firefox, but it seems to be working for me.


yes, here check again and save “project”

recheck again, copy code, logout / same
copy code into clean new edit window: works!
so same like i show above

call that sketch link from my Raspberry Pi / Raspbian OS / chromium browser /

so, i have a bad name!!!

1 Like


@kll – perhaps file a bug report?

1 Like

not much to go on.

i should try first a new account.
possibly hand my old account to a admin for check…

( i mentioned already somewhere that i have that funny noise problem too
only when i am login ( and a sketch run and FPS drops)
even published a video as proof, here but no feedback so i think of it as a local bug?? but same, also on 2 computer with different OS and browser )

/ old man play old hardware / what i expect /
i not want to waste developers time