BookStackApp / BookStack

A platform to create documentation/wiki content built with PHP & Laravel
https://www.bookstackapp.com/
MIT License
15.51k stars 1.95k forks source link

Assorted solid colours for Shelves and Books that don't have custom cover images #1240

Open seanosullivanuk opened 5 years ago

seanosullivanuk commented 5 years ago

Whilst this doesn't impact on how functional BookStack is, aesthetically it's more pleasing on the eyes to use an assortment of colour in place of the placeholder book image. Each shelf and book could have a solid colour assigned to it, or the end user is able to pick from a colour picker or list perhaps?

I've put this in place on our in-house instance and almost everyone on the team has commented positively, without me pointing out the change.

Thanks for your time, Sean

DeftNerd commented 5 years ago

I feel like this could be an opportunity to move the Gravatar configuration out of the .env file and into the Settings system.

In settings, there could be a whole "Thumbnails & Icons" section, allowing the admin to select how they want user, shelf, book, chapters, etc to be displayed. It could use the same picker used to add books to shelves.

For example, for user icons, the "available box" could include "User Upload", "Dynamic Color", "Gravatar Photo", "Gravatar Identicon", "Gravatar Monster", "Gravatar Wavatar", "Gravatar Retro", and "Gravatar Robohash". The administrator could drag over "User Upload", "Gravatar Photo", and "Gravatar Robohash" to the "picked box". The order that they're placed determines the order of operations that Bookstack uses to try to get the image and cache it. If the user hasn't uploaded an image, there is no Gravatar photo, and they didn't select a dynamic Gravatar generator, it could use the existing default photo.

The same applies to the icon generation for documents. The options could be "User Upload", "First Image", "Dynamic Color", "Gravatar Identicon", "Gravatar Retro", with a default image always as the fallback.

Gravatar dynamic generators just need a hash to make something, so a hash of the title of the document/chapter should be enough to create an image.

Dynamic color could be a Hex color value generated using the hash of the title itself, although some thought needs to be taken regarding the color of the text that lays on top and making sure the generated colors are suitable for the site. . That one might be a bit trickier. There are ways of taking a hex value, like the configured site theme color, and analyzing that to generate a range of complimentary colors.