我很想得到https://coolors.co生成的調色板的值。不幸的是,他們沒有API。如何獲得coolors的價值,甚至認爲嘿沒有API
有沒有一種方法,理想情況下用JavaScript來獲取顏色每次事件發生或我發送某種GET請求。
我沒有服務器,只是在codepen P5js草圖。
有沒有辦法僞造一個API調用,這樣我就可以每次發生一個數組或具有新生成的調色板的對象。
在我的codepen中,我想要得到一個隨機的顏色古怪的每一次點擊在mouseClicked函數上的畫布上。
筆:https://codepen.io/giorgiomartini/pen/aypWOB?editors=0010
function mouseClicked(){
background(color('hsl(185, 30%, 74%)'))
translate(width/2, height/2)
////////////////////////////////////////////////////////////////// amt initial range
const arrayOfRandomNumsOfFirstProbStepX = createArrayOfRandomNums(amtOfSpotsInFirstProb,startProbStep,firstProbStepX)
const arrayOfRandomNumsOfFirstProbStepY = createArrayOfRandomNums(amtOfSpotsInFirstProb,startProbStep,firstProbStepY)
const arrayOfRandomNumsOfSecondProbStepX = createArrayOfRandomNums(amtOfSpotsInSecondProb,startProbStep,secondProbStepX)
const arrayOfRandomNumsOfSecondProbStepY = createArrayOfRandomNums(amtOfSpotsInSecondProb,startProbStep,secondProbStepY)
//args => element, arrayOfRandomNumsOfProbStepX, arrayOfRandomNumsOfProbStepY, elmntSizeMin, elmntSizeMax, hue, sat, lightness
drawElmntsOnSomeProbabilityStep('ellipse', 3 ,arrayOfRandomNumsOfFirstProbStepX, arrayOfRandomNumsOfFirstProbStepY , 10, 80, 45, 68, 85, true)
drawElmntsOnSomeProbabilityStep('rect', 3 ,arrayOfRandomNumsOfSecondProbStepX, arrayOfRandomNumsOfSecondProbStepY, 5, 30, 212, 39, 90, true)
//linea(100,45)
}
感謝
也許與此lib https://randomcolor.llllll.li/ – mchev
它是否必須是coolors.co特別?或者會提供一個很好但隨機的配色方案的其他東西工作? – Beejamin