@erikyuzwa/rogue-punk
Version:
a JavaScript library to help you build your roguelike adventures
27 lines (26 loc) • 590 B
JavaScript
export class Glyph {
constructor(options) {
options = options || {};
this.char = options.character || ' ';
this.fgColor = options.fgColor || 'white';
this.bgColor = options.bgColor || 'black';
}
getChar() {
return this.char;
}
getBgColor() {
return this.bgColor;
}
getFgColor() {
return this.fgColor;
}
toString() {
return '%c{' +
this.fgColor +
'}%b{' +
this.bgColor +
'}' +
this.char +
'%c{white}%b{black}';
}
}