Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A simple helper, helping to determine what color the text will look better over a monotonous color.

License

NotificationsYou must be signed in to change notification settings

TheDragonCode/which-color

Repository files navigation

Which Color

A simple helper, helping to determine what color the text will look better over a monotonous color.

Stable VersionTotal DownloadsGithub Workflow StatusLicense

Installation

To get the latest version of package, simply require the project usingComposer:

composer require dragon-code/which-color

Instead, you may of course manually update your require section and runcomposer update if you so choose:

{"require": {"dragon-code/which-color":"^4.0"    }}

Using

The package helps to determine what color it is better to write text over a monotonous color.

useDragonCode\WhichColor\Facades\Color;return Color::of('#000000')->lightIsBetter();// returned `true`. A white text color is better for black background.return Color::of('#ffffff')->darkIsBetter();// returned `true`. A black text color is better for white background.return Color::of('#ffffff')->lightIsBetter();// returned `false`. White color is not the best for white background.return Color::of('#000000')->darkIsBetter();// returned `false`. Black color is not the best for black background.

You can also use the converter:

useDragonCode\WhichColor\Services\Converter;$converted =newConverter();$rgb =$converted->hex2rgb('#fa000a');// RGB object with [250, 0, 10]// $rgb->red; // 250// $rgb->green; // 0// $rgb->blue; // 10// $rgb->toArray(); // [250, 0, 10]$converted->hex2rgb('#f5a');// RGB object with [255, 85, 170]$converted->hex2rgb('#ff55aa');// RGB object with [255, 85, 170]$converted->rgb2hex($rgb);// '#fa000a'$converted->rgb2hex([250,0,10]);// '#fa000a'$converted->rgb2hex(['red' =>250,'green' =>0,'blue' =>10]);// '#fa000a'$converted->rgb2hex(['r' =>250,'g' =>0,'b' =>10]);// '#fa000a'

Example

map of colors

License

This package is licensed under theMIT License.

About

A simple helper, helping to determine what color the text will look better over a monotonous color.

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

    Contributors5

    Languages


    [8]ページ先頭

    ©2009-2025 Movatter.jp