# Fill() does not accept hexidecimal?

**URL:** <https://discourse.processing.org/t/fill-does-not-accept-hexidecimal/3920>\
**Category:** Beginners\
**Created:** [September 27, 2018, 8:50pm UTC](https://discourse.processing.org/t/fill-does-not-accept-hexidecimal/3920 "2018-09-27T20:50:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HoboGreed](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@HoboGreed](https://discourse.processing.org/u/HoboGreed)\
**Post date:** [September 27, 2018, 8:50pm UTC](https://discourse.processing.org/t/fill-does-not-accept-hexidecimal/3920/1 "2018-09-27T20:50:30Z")

</div>

```auto
function setup() {
  createCanvas(500,700);
  background(0);
}

function draw() {
  //fill(0xffff0000); // no hexidecimal ?
  fill(255,255,0);
  ellipse(200,200,250);
  }

```

---

<div class="post-metadata">

**Author:** ![tony](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/tony/32/949_2.png) [@tony](https://discourse.processing.org/u/tony)\
**Post date:** [September 27, 2018, 9:10pm UTC](https://discourse.processing.org/t/fill-does-not-accept-hexidecimal/3920/2 "2018-09-27T21:10:28Z")

</div>

I’ve changed the title to something more descriptive in case someone has this same question in the future.

While Processing-Java can take hexidecimal via the [color](https://processing.org/reference/color_datatype.html) object, [P5.Color](https://p5js.org/reference/#/p5.Color) does not support hexidecimal (as far as I know).

However, you _can_ pass a string with hexcode, like this:

```auto
fill("#ffff00ff"); 

```

Does this answer your question?

---

<div class="post-metadata">

**Author:** ![HoboGreed](https://avatars.discourse-cdn.com/v4/letter/h/da6949/32.png) [@HoboGreed](https://discourse.processing.org/u/HoboGreed)\
**Post date:** [September 27, 2018, 9:17pm UTC](https://discourse.processing.org/t/fill-does-not-accept-hexidecimal/3920/3 "2018-09-27T21:17:30Z")

</div>

Yes, thanks Tony. Maybe they will implement it in the future. Kinda disappointing though.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [September 28, 2018, 9:56pm UTC](https://discourse.processing.org/t/fill-does-not-accept-hexidecimal/3920/4 "2018-09-28T21:56:27Z")

</div>

> [@HoboGreed](#):
>
> Kinda disappointing though

Just trying to understand – what is an example of something that you cannot accomplish with

```auto
fill("#ffff00ff");

```

but would need

```auto
fill(0xffff0000);

```

?

**Edit**

I should mention that, if you have installed code with collections of numbers (any integer numbers, you could code them in hex or whatever, it is all binary underneath) then you can pass those numeric values into fill as strings with prefix `0x` and `.toString(16)`:

```auto
var num = 0x797e61;
var hexstr = "0x"+ num.toString(16);
fill(hexstr);

```

I’m not well-practiced in JavaScript, but I believe that you could just wrap that in a convenience function like this:

```auto
function hexfill (num) {
  fill("0x"+ num.toString(16));
}
var num = 0x797e61;
hexfill(num);

```
