Closed MordechaiHadad closed 8 months ago
Have you console logged namedColors?
On Wed, 10 Jan 2024 at 10:20, MordechaiHadad @.***> wrote:
I am using this lib and trying to get a color's name with Array.find but my browser console shows that namedColors import doesn't have the find function, why?
Code Example:
— Reply to this email directly, view it on GitHub https://github.com/meodai/color-names/issues/177, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAEURAVKL3NU4JSZYQURXVLYNZMNNAVCNFSM6AAAAABBUOEZ4CVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3TGOJTGMZTGMI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I did the result was:
Object { colorNameList: (30241) […] }
​
colorNameList: Array(30241) [ {…}, {…}, {…}, … ]
​
<prototype>: Object { … }
Objects don't have a find method. You can a) import it property by using
import { colorNameList } from 'color-name-list';
or use
namedColors.colorNameList.find(...)
@MordechaiHadad by the way you can also use the rest API so you don't have to carry a huge file in your codebase:
https://api.color.pizza/v1/?values=ff0000,ff0000&list=bestOf&noduplicates=true
Objects don't have a find method. You can a) import it property by using
import { colorNameList } from 'color-name-list';
or use
namedColors.colorNameList.find(...)
I suggest you update the readme then, not very clear regarding what needs to be imported. Specifically: https://github.com/meodai/color-names#exact-color
:tada: This issue has been resolved in version 10.20.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
I am using this lib and trying to get a color's name with
Array.find
but my browser console shows thatnamedColors
import doesn't have the find function, why?Code Example: https://github.com/MordechaiHadad/tints-and-shades-generator/blob/master/src/routes/%2Bpage.svelte#L26