Files
Unify/application/elements/icon.js
2025-12-25 11:16:59 +01:00

67 lines
868 B
JavaScript

import button from './button.js';
var icon_id = 0;
export default class icon{
id = icon_id++;
constructor( name, invert ) {
if( name ) {
this.background = "url( assets/images/icons/" + name + " )";
}
if( invert ) {
this.invert = 1;
this.filter = "invert(" + this.invert + ") "; //drop-shadow(0 0 4px white)
} else {
this.invert = 0;
this.filter = "invert(" + this.invert + ") "; //drop-shadow(0 0 4px white)
}
}
setImage( path ) {
this.background = "url( " + path + " )";
}
#ifdef WINDOWS
#ifdef LIGHT
filter = "invert(0)"
#endif
#ifdef DARK
filter = "invert(1)"
#endif
#endif
filter = "invert(1)";
editable = false;
backgroundSize = "contain";
width = 20;
height = 20;
}