|
1 | 1 | package com.kavi.droid.color.pallet.app.ui.tab.theme |
2 | 2 |
|
3 | | -import androidx.compose.foundation.Canvas |
4 | | -import androidx.compose.foundation.background |
5 | | -import androidx.compose.foundation.border |
6 | | -import androidx.compose.foundation.layout.Arrangement |
7 | | -import androidx.compose.foundation.layout.Box |
8 | 3 | import androidx.compose.foundation.layout.Column |
9 | 4 | import androidx.compose.foundation.layout.Row |
10 | 5 | import androidx.compose.foundation.layout.fillMaxSize |
11 | 6 | import androidx.compose.foundation.layout.fillMaxWidth |
12 | | -import androidx.compose.foundation.layout.height |
13 | 7 | import androidx.compose.foundation.layout.padding |
14 | 8 | import androidx.compose.foundation.layout.size |
15 | | -import androidx.compose.foundation.layout.width |
16 | 9 | import androidx.compose.foundation.rememberScrollState |
17 | | -import androidx.compose.foundation.shape.RoundedCornerShape |
18 | 10 | import androidx.compose.foundation.verticalScroll |
19 | 11 | import androidx.compose.material3.Button |
20 | 12 | import androidx.compose.material3.MaterialTheme |
21 | 13 | import androidx.compose.material3.Text |
22 | 14 | import androidx.compose.runtime.Composable |
23 | 15 | import androidx.compose.ui.Alignment |
24 | 16 | import androidx.compose.ui.Modifier |
25 | | -import androidx.compose.ui.draw.shadow |
26 | | -import androidx.compose.ui.graphics.Color |
27 | | -import androidx.compose.ui.text.font.FontWeight |
28 | 17 | import androidx.compose.ui.tooling.preview.Preview |
29 | 18 | import androidx.compose.ui.unit.dp |
30 | | -import com.kavi.droid.color.pallet.KvColorPallet |
| 19 | +import com.kavi.droid.color.pallet.app.ui.common.ThemeColorRow |
31 | 20 | import com.kavi.droid.color.pallet.color.MatPackage |
32 | | -import com.kavi.droid.color.pallet.model.KvColor |
33 | 21 |
|
34 | 22 | @Composable |
35 | 23 | fun ThemeColorGen(modifier: Modifier) { |
@@ -73,101 +61,6 @@ fun ThemeColorGen(modifier: Modifier) { |
73 | 61 | } |
74 | 62 | } |
75 | 63 |
|
76 | | -@Composable |
77 | | -fun ThemeColorRow(givenColor: KvColor) { |
78 | | - Box( |
79 | | - modifier = Modifier |
80 | | - .padding(10.dp) |
81 | | - ) { |
82 | | - Row(modifier = Modifier |
83 | | - .border(1.dp, Color.White, shape = RoundedCornerShape(8.dp)) |
84 | | - .shadow( |
85 | | - elevation = 10.dp, |
86 | | - shape = RoundedCornerShape(8.dp) |
87 | | - ) |
88 | | - .background(Color.White), |
89 | | - verticalAlignment = Alignment.CenterVertically |
90 | | - ) { |
91 | | - Box (modifier = Modifier |
92 | | - .width(60.dp) |
93 | | - .height(220.dp) |
94 | | - .padding(top = 16.dp, start = 16.dp, end = 4.dp, bottom = 16.dp) |
95 | | - .background(givenColor.color) |
96 | | - ) { |
97 | | - Text("BASE", |
98 | | - modifier = Modifier |
99 | | - .padding(8.dp) |
100 | | - .width(2.dp), |
101 | | - style = MaterialTheme.typography.bodySmall, |
102 | | - fontWeight = FontWeight.ExtraBold, |
103 | | - color = MaterialTheme.colorScheme.onPrimary |
104 | | - ) |
105 | | - } |
106 | | - |
107 | | - Column(modifier = Modifier |
108 | | - .fillMaxWidth(), |
109 | | - verticalArrangement = Arrangement.Center, |
110 | | - ) { |
111 | | - val appThemeColorSet = KvColorPallet.instance.generateThemeColorPallet( |
112 | | - givenColor = givenColor.color, |
113 | | - ) |
114 | | - |
115 | | - Text("Light Theme", Modifier.padding(top = 8.dp, start = 8.dp), style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.ExtraBold,) |
116 | | - |
117 | | - Row( |
118 | | - modifier = Modifier |
119 | | - .fillMaxWidth() |
120 | | - .padding(top = 4.dp, start = 8.dp, end = 8.dp, bottom = 4.dp), |
121 | | - //horizontalArrangement = Arrangement.Center |
122 | | - ) { |
123 | | - ColorCircle(appThemeColorSet.light.primary, colorLetter = "P") |
124 | | - ColorCircle(appThemeColorSet.light.secondary, colorLetter = "S") |
125 | | - ColorCircle(appThemeColorSet.light.tertiary, colorLetter = "T") |
126 | | - ColorCircle(appThemeColorSet.light.background, colorLetter = "B", letterColor = Color.Black) |
127 | | - } |
128 | | - |
129 | | - Text("Dark Theme", Modifier.padding(top = 8.dp, start = 8.dp), style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.ExtraBold,) |
130 | | - |
131 | | - Row( |
132 | | - modifier = Modifier |
133 | | - .fillMaxWidth() |
134 | | - .padding(top = 4.dp, start = 8.dp, end = 8.dp, bottom = 4.dp), |
135 | | - //horizontalArrangement = Arrangement.Center |
136 | | - ) { |
137 | | - ColorCircle(appThemeColorSet.dark.primary, colorLetter = "P") |
138 | | - ColorCircle(appThemeColorSet.dark.secondary, colorLetter = "S", letterColor = Color.Black) |
139 | | - ColorCircle(appThemeColorSet.dark.tertiary, colorLetter = "T") |
140 | | - ColorCircle(appThemeColorSet.dark.background, colorLetter = "B") |
141 | | - } |
142 | | - } |
143 | | - } |
144 | | - } |
145 | | -} |
146 | | - |
147 | | -@Composable |
148 | | -fun ColorCircle(givenColor: Color, colorLetter: String = "", letterColor: Color = MaterialTheme.colorScheme.onPrimary) { |
149 | | - |
150 | | - val circleSize = 48.dp |
151 | | - |
152 | | - Box( |
153 | | - modifier = Modifier |
154 | | - .padding(8.dp) |
155 | | - ) { |
156 | | - Canvas( |
157 | | - modifier = Modifier.size(circleSize) |
158 | | - ) { |
159 | | - drawCircle(color = givenColor, radius = circleSize.toPx() / 2) |
160 | | - } |
161 | | - |
162 | | - Text(colorLetter, modifier = Modifier |
163 | | - .padding(8.dp) |
164 | | - .align(Alignment.Center), |
165 | | - style = MaterialTheme.typography.bodyLarge, |
166 | | - color = letterColor |
167 | | - ) |
168 | | - } |
169 | | -} |
170 | | - |
171 | 64 | @Preview |
172 | 65 | @Composable |
173 | 66 | fun ThemeColorGenPreview() { |
|
0 commit comments