Skip to content

Color3:ToHex() implementation doesn't match Roblox's #407

Description

@fewkz

It appears Lune's built in roblox library Color3:ToHex() implementation uses floor, while Roblox's Color3:ToHex() uses round. Another different is that the hex output by lune's implementation is uppercase, while Roblox's is in lowercase.
Not a big deal, I just ran into this and thought I would report it for future reference.

Studio command bar
  > print(Color3.new(0.001, 0, 0):ToHex())
  000000
  > print(Color3.new(0.9999, 0, 0):ToHex())
  ff0000
  > print(Color3.new(0.5, 0.5, 0.5):ToHex())
  808080
Lune v0.10.5
> roblox = require("@lune/roblox")
> Color3 = roblox.Color3
> print(Color3.new(0.001, 0, 0):ToHex()) -- Roblox: 000000
000000
> print(Color3.new(0.9999, 0, 0):ToHex()) -- Roblox: ff0000
FE0000
> print(Color3.new(0.5, 0.5, 0.5):ToHex()) -- Roblox: 808080
7F7F7F

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions