diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-08-28 21:54:20 +0200 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-08-28 21:54:20 +0200 |
commit | 067815099f909a20fd6cf79af451dedc53bf4c54 (patch) | |
tree | 6bd04cbc8732ea25d76967c6b758bae1f11b6c13 /core/js/placeholder.js | |
parent | 54d07bd9b0448c8343b1f9424f75b859d0b3d01d (diff) | |
download | nextcloud-server-067815099f909a20fd6cf79af451dedc53bf4c54.tar.gz nextcloud-server-067815099f909a20fd6cf79af451dedc53bf4c54.zip |
calculate fontsize and line-height
Diffstat (limited to 'core/js/placeholder.js')
-rw-r--r-- | core/js/placeholder.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/js/placeholder.js b/core/js/placeholder.js index 6a1c653b587..318fe48ffa4 100644 --- a/core/js/placeholder.js +++ b/core/js/placeholder.js @@ -34,7 +34,7 @@ * * Which will result in: * - * <div id="albumart" style="background-color: rgb(123, 123, 123)">T</div> + * <div id="albumart" style="background-color: rgb(123, 123, 123); ... ">T</div> * */ @@ -45,7 +45,8 @@ red = parseInt(hash.substr(0,10), 16) / maxRange * 256, green = parseInt(hash.substr(10,10), 16) / maxRange * 256, blue = parseInt(hash.substr(20,10), 16) / maxRange * 256, - rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)]; + rgb = [Math.floor(red), Math.floor(green), Math.floor(blue)], + height = this.height(); this.css('background-color', 'rgb(' + rgb.join(',') + ')'); // CSS rules @@ -53,6 +54,10 @@ this.css('font-weight', 'bold'); this.css('text-align', 'center'); + // calculate the height + this.css('line-height', height + 'px'); + this.css('font-size', (height * 0.55) + 'px'); + if(seed !== null && seed.length) { this.html(seed[0].toUpperCase()); } |