Skip to content

Commit

Permalink
Merge branch '1.4.0' into 'release'
Browse files Browse the repository at this point in the history
  • Loading branch information
g000sha256 authored Aug 4, 2024
2 parents 00a0732 + 8e13d8e commit fdd6b1b
Show file tree
Hide file tree
Showing 13 changed files with 342 additions and 156 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Build"
name: Build

on:
push:
Expand All @@ -15,33 +15,31 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
lfs: true

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
distribution: corretto
java-version: 17

- name: Set up XCode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Binary Compatibility Validation
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew apiCheck
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.9
cache-disabled: false
cache-read-only: false

- name: Assemble
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew assemble

- name: Run tests
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew test
run: ./gradlew test

- name: Binary compatibility validation
run: ./gradlew apiCheck
35 changes: 35 additions & 0 deletions .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Dependency submission

on:
push:
branches:
- 'master'

permissions:
contents: write

jobs:
dependency-submission:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: true

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: corretto
java-version: 17

- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.9
cache-disabled: false
cache-read-only: false

- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v4
28 changes: 13 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "Release"
name: Release

on:
push:
Expand All @@ -13,37 +13,35 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
lfs: 'true'
lfs: true

- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
distribution: corretto
java-version: 17

- name: Set up XCode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Binary Compatibility Validation
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew apiCheck
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
with:
gradle-version: 8.9
cache-disabled: false
cache-read-only: false

- name: Assemble
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew assemble

- name: Run tests
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: ./gradlew test

- name: Binary compatibility validation
run: ./gradlew apiCheck

- name: Publish
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
Expand Down
85 changes: 57 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,110 @@
![License](https://img.shields.io/static/v1?color=orange&label=Platform&message=JVM)
![License](https://img.shields.io/static/v1?color=blue&label=Platform&message=iOS)
![License](https://img.shields.io/static/v1?color=white&label=Platform&message=MacOS)
![License](https://img.shields.io/static/v1?color=purple&label=Platform&message=JS)
![License](https://img.shields.io/static/v1?color=yellow&label=Platform&message=JS)

This library provides a builder for creating dynamic color schemes according to the Material 3 guidelines.
You no longer have to export large sets of colors. You can also change the theme of your application in runtime.

## Installation

#### Dependency

> The artifact coordinates have been changed from `com.github.g000sha256:material_color_scheme`
> to `dev.g000sha256:material-color-scheme`
### Dependency

```kotlin
implementation("dev.g000sha256:material-color-scheme:1.3.1")
implementation("dev.g000sha256:material-color-scheme:1.4.0")
```

#### Repository
> [!NOTE]
> The artifact coordinates have been changed from `com.github.g000sha256:material_color_scheme`
> to `dev.g000sha256:material-color-scheme`
> The repository has been changed from `maven("https://jitpack.io")` to `mavenCentral()`
### Repository

```kotlin
mavenCentral()
```

> [!NOTE]
> The repository has been changed from `maven("https://jitpack.io")` to `mavenCentral()`
## Examples

#### How to build a color scheme using any primary color
### How to build a color scheme using any primary color

```kotlin
val isDark = booleanResource(id = R.bool.is_dark)
val colorScheme = remember(isDark) {
val isDark: Boolean = TODO()
val primaryColor: Color = TODO()
val updatedColorScheme = remember(isDark, primaryColor) {
return@remember buildColorScheme(
mode = if (isDark) ColorSchemeMode.Dark else ColorSchemeMode.Light,
primary = Color(red = 0, green = 255, blue = 0)
primary = primaryColor
)
}
MaterialTheme(colorScheme = updatedColorScheme) {
// content
}
```

#### How to build a color scheme using custom colors
### How to build a color scheme using custom colors

```kotlin
val isDark = booleanResource(id = R.bool.is_dark)
val colorScheme = remember(isDark) {
val isDark: Boolean = TODO()
val primaryColor: Color = TODO()
val secondaryColor: Color = TODO()
val tertiaryColor: Color = TODO()
val neutralColor: Color = TODO()
val neutralVariantColor: Color = TODO()
val errorColor: Color = TODO()
val updatedColorScheme = remember(isDark, primaryColor, secondaryColor, tertiaryColor, neutralColor, neutralVariantColor, errorColor) {
return@remember buildColorScheme(
mode = if (isDark) ColorSchemeMode.Dark else ColorSchemeMode.Light,
primary = Color(red = 0, green = 255, blue = 0),
secondary = Color(red = 115, green = 155, blue = 100),
tertiary = Color(red = 0, green = 160, blue = 170),
neutral = Color(red = 145, green = 145, blue = 140),
neutralVariant = Color(red = 140, green = 145, blue = 135),
error = Color(red = 255, green = 85, blue = 75)
primary = primaryColor,
secondary = secondaryColor,
tertiary = tertiaryColor,
neutral = neutralColor,
neutralVariant = neutralVariantColor,
error = errorColor
)
}
MaterialTheme(colorScheme = updatedColorScheme) {
// content
}
```

#### How to override generated colors
### How to override generated colors

```kotlin
val isDark = booleanResource(id = R.bool.is_dark)
val colorScheme = remember(isDark) {
val isDark: Boolean = TODO()
val primaryColor: Color = TODO()
val outlineColor: Color = TODO()
val updatedColorScheme = remember(isDark, primaryColor, outlineColor) {
val scheme = buildColorScheme(
mode = if (isDark) ColorSchemeMode.Dark else ColorSchemeMode.Light,
primary = Color(red = 0, green = 255, blue = 0)
primary = primaryColor
)
return@remember scheme.copy(
outline = Color(red = 50, green = 50, blue = 50)
outline = outlineColor,
// override other colors here
)
}
MaterialTheme(colorScheme = updatedColorScheme) {
// content
}
```

#### How to apply
### How to animate changes

```kotlin
MaterialTheme(colorScheme = colorScheme) {
val isDark: Boolean = TODO()
val primaryColor: Color = TODO()
val updatedColorScheme = remember(isDark, primaryColor) {
return@remember buildColorScheme(
mode = if (isDark) ColorSchemeMode.Dark else ColorSchemeMode.Light,
primary = primaryColor
)
}
val animatedColorScheme = animateColorScheme(updatedColorScheme)
MaterialTheme(colorScheme = animatedColorScheme) {
// content
}
```
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
public final class g000sha256/material/color_scheme/ColorSchemeAnimatorKt {
public static final fun animateColorScheme (Landroidx/compose/material3/ColorScheme;Landroidx/compose/animation/core/AnimationSpec;Landroidx/compose/runtime/Composer;II)Landroidx/compose/material3/ColorScheme;
}

public final class g000sha256/material/color_scheme/ColorSchemeBuilderKt {
public static final fun buildColorScheme-ASVOZCQ (Lg000sha256/material/color_scheme/ColorSchemeMode;JLandroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;J)Landroidx/compose/material3/ColorScheme;
public static synthetic fun buildColorScheme-ASVOZCQ$default (Lg000sha256/material/color_scheme/ColorSchemeMode;JLandroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;JILjava/lang/Object;)Landroidx/compose/material3/ColorScheme;
}

public abstract class g000sha256/material/color_scheme/ColorSchemeMode {
public static final field $stable I
}

public final class g000sha256/material/color_scheme/ColorSchemeMode$Dark : g000sha256/material/color_scheme/ColorSchemeMode {
public static final field $stable I
public static final field INSTANCE Lg000sha256/material/color_scheme/ColorSchemeMode$Dark;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class g000sha256/material/color_scheme/ColorSchemeMode$Light : g000sha256/material/color_scheme/ColorSchemeMode {
public static final field $stable I
public static final field INSTANCE Lg000sha256/material/color_scheme/ColorSchemeMode$Light;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
public final class g000sha256/material/color_scheme/ColorSchemeAnimatorKt {
public static final fun animateColorScheme (Landroidx/compose/material3/ColorScheme;Landroidx/compose/animation/core/AnimationSpec;Landroidx/compose/runtime/Composer;II)Landroidx/compose/material3/ColorScheme;
}

public final class g000sha256/material/color_scheme/ColorSchemeBuilderKt {
public static final fun buildColorScheme-ASVOZCQ (Lg000sha256/material/color_scheme/ColorSchemeMode;JLandroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;J)Landroidx/compose/material3/ColorScheme;
public static synthetic fun buildColorScheme-ASVOZCQ$default (Lg000sha256/material/color_scheme/ColorSchemeMode;JLandroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;Landroidx/compose/ui/graphics/Color;JILjava/lang/Object;)Landroidx/compose/material3/ColorScheme;
}

public abstract class g000sha256/material/color_scheme/ColorSchemeMode {
public static final field $stable I
}

public final class g000sha256/material/color_scheme/ColorSchemeMode$Dark : g000sha256/material/color_scheme/ColorSchemeMode {
public static final field $stable I
public static final field INSTANCE Lg000sha256/material/color_scheme/ColorSchemeMode$Dark;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class g000sha256/material/color_scheme/ColorSchemeMode$Light : g000sha256/material/color_scheme/ColorSchemeMode {
public static final field $stable I
public static final field INSTANCE Lg000sha256/material/color_scheme/ColorSchemeMode$Light;
public fun equals (Ljava/lang/Object;)Z
public fun hashCode ()I
Expand Down
Loading

0 comments on commit fdd6b1b

Please sign in to comment.