Giter Club home page Giter Club logo

Comments (8)

uyab avatar uyab commented on May 24, 2024

You can override the config file: https://github.com/laravolt/avatar/blob/master/config/config.php

Place it in config/laravolt/avatar.php

from avatar.

ezeveliz avatar ezeveliz commented on May 24, 2024

@uyab I know, but what I wanted is to check for contrast so, if a dark background is chosen, to choose a light foreground, and if a light background is chosen, to choose a dark foreground.
All I can do in config is to give a list of colors, but they're chosen randomly, so contrast is not always ok.

from avatar.

uyab avatar uyab commented on May 24, 2024

Ah i see, do you have any idea how this should be implemented?

from avatar.

ezeveliz avatar ezeveliz commented on May 24, 2024

What I wanted to do was override create(I think), first choose a background randomly and then check contrast against black or white(those would be the possible foregrounds), and choose the one with the higher contrast.

from avatar.

mirko77 avatar mirko77 commented on May 24, 2024

Would be better to randomize both, picking from a selection of foreground/background colors.?

I guess an array of 20 possible color combinations will do

Any suggestion?

from avatar.

uyab avatar uyab commented on May 24, 2024

I think it is a good idea to have some theming functionality.

Currently there is only one pair of background-foreground colors.

    'foregrounds'   => [
        '#FFFFFF',
        '#000000',
    ],
    'backgrounds'   => [
        '#f44336',
        '#E91E63',
    ],

We can make a new config value, let's call it themes:

    'themes' => [
        'monochrome' => [
            'foregrounds' => [
                '#FFFFFF',
            ],
            'backgrounds' => [
                '#000000',
            ],
        ],
        'material' => [
            'foregrounds' => [
                '#FFFFFF',
            ],
            'backgrounds' => [
                '#000000',
            ],
        ]        
    ],

And choose active theme with:

'theme' => ['theme1', 'theme2'] // will randomly choose pair of bg-fg colors from each theme
'theme' => [] // or null or false, will randomly choose colors from all defined themes

Is this a good idea? Anybody willing to make a PR ?

from avatar.

Mindexperiment avatar Mindexperiment commented on May 24, 2024

Hi all, there are functions to calculate contrasts between colors.

Take a look:
https://ux.stackexchange.com/questions/107318/formula-for-color-contrast-between-text-and-background
https://medium.com/dev-channel/using-sass-to-automatically-pick-text-colors-4ba7645d2796

from avatar.

uyab avatar uyab commented on May 24, 2024

Theming are available since 3.0.0. You can define multiple color combination (themes) and of course you need to check the contrast manually.

from avatar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.