Improved grammar
This commit is contained in:
parent
3b632fedd1
commit
20cc971076
@ -41,13 +41,17 @@ function randomise_params() {
|
||||
}
|
||||
|
||||
function colour_to_text(d3color) {
|
||||
return GetColorName(d3color.formatHex()).toLowerCase();
|
||||
const rawname = GetColorName(d3color.formatHex()).toLowerCase();
|
||||
// some return values are things like "cyan / aqua": take the first
|
||||
const parts = rawname.split(/\//);
|
||||
return parts[0].trim();
|
||||
}
|
||||
|
||||
function image_description(params) {
|
||||
const bgc = colour_to_text(params.background);
|
||||
const dotc = params.patterns.map((p) => colour_to_text(p.colour));
|
||||
return `A pattern of ${dotc[0]} and ${dotc[1]} dots on a ${bgc} background`;
|
||||
const a = bgc.match(/^[aeiou]/) ? 'an' : 'a';
|
||||
return `A pattern of ${dotc[0]} and ${dotc[1]} dots on ${a} ${bgc} background`;
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user