Compare commits
2 commits
9343a28ca0
...
4935439056
Author | SHA1 | Date | |
---|---|---|---|
4935439056 | |||
4e5c17511c |
2 changed files with 8 additions and 3 deletions
|
@ -59,12 +59,12 @@ function App() {
|
||||||
}
|
}
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let message = document.getElementById("ubuntucola").value as string
|
let message = document.getElementById("ubuntucola").value as string
|
||||||
setMessage(getmisskeycolors(message, colors));
|
setMessage(getmisskeycolors(message, colors).replace(/\$\[fg\.color=[0-9A-Fa-f]{6} \]/g, ''));
|
||||||
}}>
|
}}>
|
||||||
generate!
|
generate!
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<span>{message()}</span>
|
<code>{message()}</code>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
|
@ -52,8 +52,13 @@ export function getmisskeycolors(message:string, colors:string[]){
|
||||||
const [low, high , progress] = sampleFromArray(colors, i / (message.length - 1))
|
const [low, high , progress] = sampleFromArray(colors, i / (message.length - 1))
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const color = lerpoklab(tozerotoone(colors[low]), tozerotoone(colors[high]), progress)
|
const color = lerpoklab(tozerotoone(colors[low]), tozerotoone(colors[high]), progress)
|
||||||
|
if (message[i] === " ") {
|
||||||
|
finalmessage += " "
|
||||||
|
} else {
|
||||||
finalmessage += (`$[fg.color=${tohexstring(color).substring(1)} ${message[i]}]`)
|
finalmessage += (`$[fg.color=${tohexstring(color).substring(1)} ${message[i]}]`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return finalmessage
|
return finalmessage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue