-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading constant colors from resources & doc (#6)
* ➕Add Kover ♻️Refactor tests * ➕Move to kotest form pure JUnit * ✨Reimplement const colors parsing * 📝Update readme --------- Co-authored-by: quicklybly <[email protected]>
- Loading branch information
1 parent
f45ec25
commit 259c188
Showing
51 changed files
with
1,588 additions
and
1,342 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Verify PR labels | ||
|
||
on: | ||
pull_request: | ||
types: [ opened, labeled, unlabeled, synchronize ] | ||
|
||
jobs: | ||
label_check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: zwaldowski/match-label-action@v2 | ||
with: | ||
allowed: fix, features, documentation, config | ||
|
||
build_and_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⚡️Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🐘Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: 🍻Gradle build | ||
run: ./gradlew test executableJar | ||
# - name: 🚀Upload artifact | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: JAR | ||
# path: build/libs/*-executable.jar | ||
# retention-days: 1 | ||
kover_report: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⚡️Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🐘Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: 📑Generate kover coverage report | ||
run: ./gradlew koverXmlReport | ||
- name: ➕Add coverage report to PR | ||
id: kover | ||
uses: mi-kas/kover-report@v1 | ||
with: | ||
path: | | ||
${{ github.workspace }}/colsum/build/reports/kover/report.xml | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
title: Code Coverage | ||
update-comment: true | ||
min-coverage-overall: 60 | ||
min-coverage-changed-files: 60 | ||
coverage-counter-type: LINE |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,43 @@ | ||
# colsum | ||
Simple cli util for intersecting colors | ||
<div style="right:0; position: absolute; width: 100px; height: 150px; opacity: 80%"> | ||
<div style="position: absolute; width: 50px; height: 50px; background-color: blue; z-index: 2"></div> | ||
<div style="top: 30px; left: 30px; position: absolute; width: 50px; height: 50px; background-color: aqua; z-index: 1"></div> | ||
<div style="top: 30px; left: 30px; position: absolute; width: 50px; height: 50px; background-color: rgba(0,255,255,0.54); z-index: 3"></div> | ||
</div> | ||
|
||
# $ colsum | ||
|
||
Simple command line tool for overlaying colors | ||
|
||
```shell | ||
java -jar colsum.jar -b "aqua" -e "rgb(55, 12, 2, 0.4) + rgba(1, 50, 217, 0.3)" | ||
``` | ||
|
||
<div style="font-size: 20px"> | ||
Usage:<br> | ||
<div style="margin-left: 25px"> | ||
— expression, -e -> Expression for computation (always required) { String }<br> | ||
— background, -b [#FFF] -> background color { String }<br> | ||
— help, -h -> Usage info<br> | ||
</div> | ||
</div> | ||
|
||
# 🧑💻 For new contributors | ||
|
||
🚧 Under construction 🚧 | ||
|
||
# 🔧 Internals | ||
|
||
A brief structural components overview | ||
|
||
## 🔍️ Parser | ||
|
||
🚧 Under construction 🚧 | ||
|
||
## 🎨 Alpha composition formulas | ||
|
||
Сolors are superimposed like, for example, in the Mozilla Firefox browser. Formulas are presented below: | ||
|
||
``` | ||
result alpha = background alpha * (1 - new alpha) + new alpha | ||
result color[R,G,B] = background alpha * (1 - new alpha) * background color + new color * new alpha | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package color | ||
|
||
import kotlinx.serialization.decodeFromString | ||
import kotlinx.serialization.json.Json | ||
import utils.ResourcePaths.CONSTANT_COLORS | ||
import java.io.File | ||
import java.util.regex.Pattern | ||
import java.util.regex.Pattern.CASE_INSENSITIVE | ||
|
||
|
||
object ConstantColorsService { | ||
private val colors: Map<String, CssColor> = | ||
Json.decodeFromString<Map<String, String>>(CONSTANT_COLORS.getResource()) | ||
.mapValues { CssColor.fromHEX(it.value) } | ||
|
||
fun getNamesRegex() = Pattern.compile(colors.keys.joinToString(separator = "|"), CASE_INSENSITIVE)!!.toRegex() | ||
operator fun get(name: String): CssColor = colors[name]!! | ||
} |
Oops, something went wrong.