elixir-image/image

Hex code fill color for `Image.Text.simple_text/2` is broken.

Closed this issue · 2 comments

a8t commented

Great library! I ran into this issue:

Let me know if you need help reproducing.

iex(16)>  Image.Text.simple_text(name,
   autofit: true,
   width: 290,
   height: 50
   text_fill_color: "#A15B35"
 ) 
 
 ** (CaseClauseError) no case clause matching: [161, 91, 53]
    (image 0.15.0) lib/image/options/new.ex:99: Image.Options.New.validate_option/2
    (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
    (elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
    (image 0.15.0) lib/image/options/new.ex:43: Image.Options.New.validate_options/1
    (image 0.15.0) lib/image.ex:332: Image.new/3
    (image 0.15.0) lib/image/text.ex:879: Image.Text.render_text/2
    (image 0.15.0) lib/image/text.ex:367: Image.Text.simple_text/2
    (travel_tag 0.1.0) lib/travel_tag/travel.ex:108: TravelTag.Travel.make_image/1

I feel that maybe deps/image/lib/image/color.ex:108 should be {:ok, [String.to_integer(r, 16), String.to_integer(g, 16), String.to_integer(b, 16)]}.

I've fixed this issue on the main branch. If you're able to validate the fix is good then I'll publish a new version to hex. Thanks for the report and encouragement.

a8t commented

Works great!! BTW, the docs (at README.md:18) still say to use v0.14.0 😄