03.10.2015, 17:56
(
Last edited by AbyssMorgan; 26/09/2019 at 04:35 PM.
Reason: Update 2.5.0
)
Include contain functions for color conversion
Download:
RGB.inc
Website:
Color Converter
Example 1:
Example 2:
Example 3:
Example 4:
PHP Code:
/****************************************************************************************************
* *
* )( R G B A Conversion )( *
* *
* Copyright © 2019 Abyss Morgan. All rights reserved. *
* *
* Website: adm.ct8.pl *
* Download: adm.ct8.pl/r/download *
* *
* Plugins: None *
* Modules: None *
* *
* File Version: 2.5.0 *
* *
* Functions: *
* RGB::RGBAToHex(color,&red,&green,&blue,&alpha); *
* RGB::RGBToHex(color,&red,&green,&blue); *
* RGB::HexToRGBA(red,green,blue,alpha); *
* RGB::HexToARGB(red,green,blue,alpha); *
* RGB::HexToRGB(red,green,blue); *
* RGB::RGBAToRGB(color); *
* RGB::RGBToRGBA(color,alpha); *
* RGB::RGBToARGB(color,alpha); *
* RGB::ARGBToRGB(color); *
* RGB::RGBAToARGB(color); *
* RGB::ARGBToRGBA(color); *
* RGB::GetRFromRGBA(color); //RGBA:0xFAB0A0FF R:0xFA000000 *
* RGB::GetGFromRGBA(color); //RGBA:0xFAB0A0FF G:0x00B00000 *
* RGB::GetBFromRGBA(color); //RGBA:0xFAB0A0FF B:0x0000A000 *
* RGB::GetAFromRGBA(color); //RGBA:0xFAB0A0FF A:0x000000FF *
* RGB::GetRHexFromRGBA(color); //RGBA:0xFAB0A0FF R:0xFA *
* RGB::GetGHexFromRGBA(color); //RGBA:0xFAB0A0FF G:0xB0 *
* RGB::GetBHexFromRGBA(color); //RGBA:0xFAB0A0FF B:0xA0 *
* RGB::GetAHexFromRGBA(color); //RGBA:0xFAB0A0FF A:0xFF *
* RGB::GetColorRGBA(color); //Return {RGB} *
* RGB::GetColorRGB(color); //Return {RGB} *
* RGB::GetColorARGB(color); //Return {RGB} *
* RGB::AdjustColorLuminance(color,Float:adjust); *
* *
****************************************************************************************************/
RGB.inc
Website:
Color Converter
Example 1:
PHP Code:
new col = RGB::RGBAToARGB(0xFF6600FF); //return 0xFFFF6600;
PHP Code:
new red, green, blue, alpha;
RGB::RGBAToHex(0xFF6600AA,red,green,blue,alpha); //return red = 0xFF; green = 0x66; blue = 0x00; alpha = 0xAA;
PHP Code:
new r = RGB::GetRHexFromRGBA(0xFF6600AA); //return 0xFF;
PHP Code:
new r = RGB::GetRFromRGBA(0xFF6600AA); //return 0xFF000000;