-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add possibility to change status color (via #23)
- Loading branch information
1 parent
bbd2c9b
commit 3510ccd
Showing
6 changed files
with
79 additions
and
36 deletions.
There are no files selected for viewing
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
35 changes: 35 additions & 0 deletions
35
src/main/java/io/github/eroshenkoam/allure/StatusColors.java
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,35 @@ | ||
package io.github.eroshenkoam.allure; | ||
|
||
import io.qameta.allure.model.Status; | ||
|
||
import java.awt.*; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
public class StatusColors { | ||
|
||
private final Map<Status, String> statusColors; | ||
|
||
public StatusColors() { | ||
statusColors = new HashMap<Status, String>() {{ | ||
put(Status.PASSED, "#97cc64"); | ||
put(Status.FAILED, "#fd5a3e"); | ||
put(Status.BROKEN, "#ffd050"); | ||
put(Status.SKIPPED, "#aaaaaa"); | ||
}}; | ||
} | ||
|
||
public void setStatusColors(final Status status, String color) { | ||
statusColors.put(status, color); | ||
} | ||
|
||
public Color getStatusColor(final Status status) { | ||
final String hex = Optional.ofNullable(status) | ||
.map(statusColors::get) | ||
.orElse("#BF98A6FF"); | ||
return Color.decode(hex); | ||
} | ||
|
||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/main/java/io/github/eroshenkoam/allure/option/StatusColorOptions.java
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,24 @@ | ||
package io.github.eroshenkoam.allure.option; | ||
|
||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
import picocli.CommandLine; | ||
|
||
import java.io.Serializable; | ||
|
||
@Data | ||
@Accessors(chain = true) | ||
public class StatusColorOptions implements Serializable { | ||
|
||
private static final long serialVersionUID = 1L; | ||
|
||
@CommandLine.Option(names = "--status.color.passed", defaultValue = "#97cc64") | ||
private String passed; | ||
@CommandLine.Option(names = "--status.color.failed", defaultValue = "#fd5a3e") | ||
private String failed; | ||
@CommandLine.Option(names = "--status.color.broken", defaultValue = "#ffd050") | ||
private String broken; | ||
@CommandLine.Option(names = "--status.color.skipped", defaultValue = "#aaaaaa") | ||
private String skipped; | ||
|
||
} |
31 changes: 0 additions & 31 deletions
31
src/main/java/io/github/eroshenkoam/allure/util/ColorUtils.java
This file was deleted.
Oops, something went wrong.