mirror of
https://github.com/InsanusMokrassar/docs.git
synced 2025-10-04 22:49:30 +00:00
add colors
This commit is contained in:
37
docs/micro_utils/colors.md
Normal file
37
docs/micro_utils/colors.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Colors [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/colors.common)
|
||||
|
||||
* `Group`: `dev.inmo`
|
||||
* `ArtifactId`: `colors.common`
|
||||
|
||||
Adding dependency:
|
||||
|
||||
```groovy
|
||||
implementation "dev.inmo:colors.common:latest"
|
||||
```
|
||||
|
||||
> INFO:
|
||||
>
|
||||
> All the samples below will represent `HEXAColor` with `r==0xaa`, `g==0xff`, `b==0x00` and `a==0xff`
|
||||
|
||||
This package contains mainly one file: [HEXAColor](https://microutils.inmo.dev/micro_utils.dokka/dev.inmo.micro_utils.colors.common/-h-e-x-a-color/index.html). This file
|
||||
contains unified color with HEXA format. It consumes `UInt` by default constructor and r/g/b/a parameters in other main constructors:
|
||||
|
||||
```kotlin
|
||||
HEXAColor(0xaaff00ffu) // 0xRGBAu as UInt
|
||||
HEXAColor(r = 0xaa, g = 0xff, b = 0x00, a = 0xff)
|
||||
HEXAColor(r = 0xaa, g = 0xff, b = 0x00, aOfOne = 1f)
|
||||
```
|
||||
|
||||
Besides, you may use one of converters:
|
||||
|
||||
```kotlin
|
||||
HEXAColor.fromAhex(0xffaaff00u) // 0xARGBu as UInt
|
||||
HEXAColor.parse("rgba(aa, ff, 00, ff)")
|
||||
HEXAColor.parse("rgba(aa, ff, 00)")
|
||||
HEXAColor.parse("#af0")
|
||||
HEXAColor.parse("#af0f")
|
||||
HEXAColor.parse("#aaff00")
|
||||
HEXAColor.parse("#aaff00ff")
|
||||
```
|
||||
|
||||
|
42
docs/micro_utils/colors.template.md
Normal file
42
docs/micro_utils/colors.template.md
Normal file
@@ -0,0 +1,42 @@
|
||||
group=dev.inmo
|
||||
artifact=colors.common
|
||||
package=$group.$artifact
|
||||
central_package=$group/$artifact
|
||||
|
||||
# Colors [](https://maven-badges.herokuapp.com/maven-central/${central_package})
|
||||
|
||||
* `Group`: `$group`
|
||||
* `ArtifactId`: `$artifact`
|
||||
|
||||
Adding dependency:
|
||||
|
||||
```groovy
|
||||
implementation "$group:$artifact:latest"
|
||||
```
|
||||
|
||||
> INFO:
|
||||
>
|
||||
> All the samples below will represent `HEXAColor` with `r==0xaa`, `g==0xff`, `b==0x00` and `a==0xff`
|
||||
|
||||
This package contains mainly one file: [HEXAColor](https://microutils.inmo.dev/micro_utils.dokka/dev.inmo.micro_utils.colors.common/-h-e-x-a-color/index.html). This file
|
||||
contains unified color with HEXA format. It consumes `UInt` by default constructor and r/g/b/a parameters in other main constructors:
|
||||
|
||||
```kotlin
|
||||
HEXAColor(0xaaff00ffu) // 0xRGBAu as UInt
|
||||
HEXAColor(r = 0xaa, g = 0xff, b = 0x00, a = 0xff)
|
||||
HEXAColor(r = 0xaa, g = 0xff, b = 0x00, aOfOne = 1f)
|
||||
```
|
||||
|
||||
Besides, you may use one of converters:
|
||||
|
||||
```kotlin
|
||||
HEXAColor.fromAhex(0xffaaff00u) // 0xARGBu as UInt
|
||||
HEXAColor.parse("rgba(aa, ff, 00, ff)")
|
||||
HEXAColor.parse("rgba(aa, ff, 00)")
|
||||
HEXAColor.parse("#af0")
|
||||
HEXAColor.parse("#af0f")
|
||||
HEXAColor.parse("#aaff00")
|
||||
HEXAColor.parse("#aaff00ff")
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user