diff --git a/R/color_functions.R b/R/color_functions.R index f899276..a48a603 100644 --- a/R/color_functions.R +++ b/R/color_functions.R @@ -23,7 +23,7 @@ colors_name = function(x, label = c("i", "H", "C", "L", "CRW", "CRB")) { structure(x, names = round(df[[label]], 2)) } -get_dist_matrices = function(p, th = 15) { +get_dist_matrices = function(p) { #norm = cols4all:::get_dist_matrix(p, cvd = "none") res = lapply(c("protan", "deutan", "tritan", "none"), function(cvd) { @@ -86,73 +86,168 @@ colors_order = function(x, head = 1, weight_normal = 0) { x[ids] } -colors_cbf_set = function(x, k, plot = TRUE, dE_min = 10, columns = 2, cex = 1, required = NULL, top = 20, parallelize = NA) { - if (!is.list(required) && !is.null(required)) required = list(required) - ms = get_dist_matrices(x, th = dE_min) - n = length(x) - ncomb = choose(n,k) - message("There are ", ncomb, " combinations to check") +colors_cbf_set = function(x, k = NA, option_list = NULL, plot = TRUE, dE_min = 10, columns = 2, cex = 1, required = NULL, top = 20, parallelize = NA, ncores = 4, batch.size = 2e7, max.size = 100e7, step = -1, dir = "temp", init = NULL) { + # step -1: initialize only (return init) + # step 0: all + # step 1, ... batch process + # step Inf, only combining results - if (is.na(parallelize)) { - parallelize = ncomb > 1e7 - } + if (step < 1 || is.null(init)) { + if (!is.list(required) && !is.null(required)) required = list(required) - y = combn(1:n, k) + stopifnot(!(is.na(k) && is.null(option_list))) - message("Starting now...") - if (parallelize) { - message("In parallel") - ncores = parallel::detectCores() - cl = parallel::makeCluster(ncores) - on.exit(parallel::stopCluster(cl)) - } + message("Step 0a: Initialize: calculating combinations") + n = length(x) - if (!is.null(required)) { - sel = apply(y, MARGIN = 2, function(x) { - all(vapply(required, function(req) { - any(req %in% x) - }, FUN.VALUE = logical(1))) - }) - message("After filtering by required colors ", ncol(y2), " combinations are left") - y2 = y[, sel] + if (!is.null(option_list)) { + option_list = lapply(option_list, as.integer) + y = unname(t(do.call(expand.grid, option_list))) + ncomb = ncol(y) + } else { + ncomb = choose(n,k) + } + + if (ncomb >= max.size) stop("Number of combinations is ", formatC(ncomb, format = "fg", big.mark = ",")) + + message("Number of combinations: ", formatC(ncomb, format = "fg", big.mark = ",")) + + if (is.null(option_list)) { + y = combn(1:n, k) + + message("Starting now...") + + if (!is.null(required)) { + sel = apply(y, MARGIN = 2, function(x) { + all(vapply(required, function(req) { + any(req %in% x) + }, FUN.VALUE = logical(1))) + }) + message("After filtering by required colors ", ncol(y), " combinations are left") + y = y[, sel] + + } + } + + ny = ncol(y) + + ## + message("Step 0b: Create batch files") + + start = seq(1, ny + batch.size, by = batch.size) + end = start[-1] - 1 + start = head(start, -1) + if (end[length(end)] != ny) end[length(end)] = ny + + bn = length(start) + + if (!dir.exists(dir)) dir.create(dir) + + fls = paste0(dir, "/k", k, "_batch_", 1L:bn, ".rds") + + if (!all(file.exists(fls))) { + for (i in 1L:bn) { + ysel = y[, start[i]:end[i]] + saveRDS(ysel, file = fls[i]) + } + } + + rm(y) + gc() + + if (step == -1) { + return(list(k = k, + x = x, + ny = ny, + start = start, + end = end, + dE_min = dE_min, + bn = bn, + fls = fls)) + } } else { - y2 = y + k = init$k + x = init$x + ny = init$ny + start = init$start + end = init$end + bn = init$bn + dE_min = init$dE_min + fls = init$fls + } + + if (is.na(parallelize)) { + parallelize = ny >= 1e7 } - if (parallelize) { - res = parallel::parApply(cl = cl, X = y2, MARGIN = 2, function(yi) { - mins = vapply(ms, function(m) { - min(m[yi,yi], na.rm = TRUE) - }, FUN.VALUE = numeric(1)) - which.min(mins) * 1000 + min(mins) + step = max(step, 1) + + if (step != Inf) { + ms = get_dist_matrices(x) + + if (parallelize) { + message("In parallel") + ncores = if (is.na(ncores)) parallel::detectCores() else ncores + cl = parallel::makeCluster(ncores) + on.exit(parallel::stopCluster(cl)) + } + + dfs = lapply(step:bn, function(s) { + message("Step ", s) + y = readRDS(fls[s]) + if (parallelize) { + res = parallel::parApply(cl = cl, X = y, MARGIN = 2, function(yi) { + mins = vapply(ms, function(m) { + min(m[yi,yi], na.rm = TRUE) + }, FUN.VALUE = numeric(1)) + which.min(mins) * 1000 + min(mins) + }) + } else { + res = pbapply::pbapply(y, MARGIN = 2, function(yi) { + mins = vapply(ms, function(m) { + min(m[yi,yi], na.rm = TRUE) + }, FUN.VALUE = numeric(1)) + which.min(mins) * 1000 + min(mins) + }) + + } + whichType = res %/% 1000 + dE = res %% 1000 + + ids = which(dE > dE_min) + + if (!length(ids)) { + message("maximum Delta E value is ", max(dE)) + ids = which(dE >= floor(max(dE))) + } + df = cbind(as.data.frame(t(y[,ids])), dist = dE[ids], type = names(ms)[whichType[ids]]) + saveRDS(df, paste0(dir, "/k", k, "_df_", s, ".rds")) + df }) + if (step > 1) { + dfs0 = lapply(1:(step-1), function(s) { + readRDS(paste0(dir, "/k", k, "_df_", s, ".rds")) + }) + dfs = rbind(dfs0, dfs) + } } else { - res = pbapply::pbapply(y2, MARGIN = 2, function(yi) { - mins = vapply(ms, function(m) { - min(m[yi,yi], na.rm = TRUE) - }, FUN.VALUE = numeric(1)) - which.min(mins) * 1000 + min(mins) + dfs = lapply(step:bn, function(s) { + readRDS(paste0(dir, "/k", k, "_df_", s, ".rds")) }) - } - whichType = res %/% 1000 - dE = res %% 1000 - ids = which(dE > dE_min) - if (!length(ids)) { - message("maximum Delta E value is ", max(dE)) - ids = which(dE >= floor(max(dE))) - } + df = do.call(rbind, dfs) - df = cbind(as.data.frame(t(y2[,ids])), dist = dE[ids], type = names(ms)[whichType[ids]]) df2 = df[order(df$dist, decreasing = TRUE), ] + message("Complete") + if (plot) { if (nrow(df2) > top) { message(nrow(df2), " palettes found. Plotting only the top ", top) @@ -171,14 +266,21 @@ colors_cbf_set = function(x, k, plot = TRUE, dE_min = 10, columns = 2, cex = 1, invisible(z) } -colors_remove_twins = function(x, th = 2) { +colors_remove_twins = function(x, th = 2, include.cvd = FALSE) { n = length(x) - d = cols4all:::get_dist_matrix(x) + + if (include.cvd) { + m = cols4all:::get_dist_matrices(x) + d = do.call(pmin, m) + } else { + d = cols4all:::get_dist_matrix(x) + + } + d[lower.tri(d)] = NA ids = which(d < th) rids = ((ids - 1) %/% n) + 1 cids = ((ids - 1) %% n) + 1 - intersect(cids, rids) keeps = setdiff(cids, rids) rem = setdiff(c(rids,cids), keeps) remain = setdiff(1L:n, rem) diff --git a/R/get_z_n.R b/R/get_z_n.R index 472832c..a60ed4f 100644 --- a/R/get_z_n.R +++ b/R/get_z_n.R @@ -43,9 +43,9 @@ get_z_n = function(z, n = NA, m = NA, filters = character(0), range = NA, colors } else if (f == "naming") { z3$nameable } else if (f == "crW") { - z3$contrastWT + !z3$contrastWT } else if (f == "crB") { - z3$contrastBK + !z3$contrastBK } }) fsel = Reduce("&", sels) diff --git a/build/build_c4a_pals.R b/build/build_c4a_pals.R index f5f2e2f..2f65794 100644 --- a/build/build_c4a_pals.R +++ b/build/build_c4a_pals.R @@ -236,48 +236,439 @@ c4a_plot_lines(line9, lwd = 3) ############# cbf ############# ####################################### +######## old pool for twilight +dput(pool_twilight) +pool_cvd = c("#CC6677", "#A5170E", "#FF9D9A", "#E65518", "#8C564B", "#997700", + "#F1CE63", "#DDCC77", "#AAAA00", "#999933", "#59A14F", "#225522", + "#009988", "#99DDFF", "#77AADD", "#3969AC", "#4B4B8F", "#9467BD", + "#B07AA1", "#882255", "#FABFD2", "#D37295", "#E73F74") +c4a_twilight7 = list(twilight7a = c("#DDCC77", "#999933", "#225522", "#77AADD", "#3969AC", "#882255", "#D37295"), + twilight7b = c("#F1CE63", "#59A14F", "#225522", "#99DDFF", "#9467BD", "#882255", "#D37295"), + twilight7c = c("#FF9D9A", "#AAAA00", "#225522", "#99DDFF", "#3969AC", "#882255", "#E73F74"), + twilight7d = c("#E65518", "#F1CE63", "#225522", "#009988", "#99DDFF", "#9467BD", "#882255")) +c4a_twilight9 = list(twilight9a = c("#FF9D9A", "#997700", "#AAAA00", "#225522", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight9b = c("#A5170E", "#997700", "#AAAA00", "#009988", "#4B4B8F", "#9467BD", "#882255", "#FABFD2", "#E73F74"), + twilight9c = c("#F1CE63", "#999933", "#225522", "#009988", "#99DDFF", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight9d = c("#A5170E", "#997700", "#F1CE63", "#009988", "#99DDFF", "#4B4B8F", "#9467BD", "#882255", "#E73F74")) +c4a_twilight5 = list(twilight5a = c("#A5170E", "#F1CE63", "#009988", "#99DDFF", "#4B4B8F"), + twilight5b = c("#CC6677", "#F1CE63", "#225522", "#99DDFF", "#9467BD"), + twilight5c = c("#CC6677", "#A5170E", "#AAAA00", "#77AADD", "#3969AC")) +c4a_twilight11 = list(twilight11a = c("#CC6677", "#FF9D9A", "#997700", "#F1CE63", "#AAAA00", "#225522", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255"), + twilight11b = c("#FF9D9A", "#F1CE63", "#AAAA00", "#225522", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#B07AA1", "#882255", "#E73F74"), + twilight11c = c("#A5170E", "#FF9D9A", "#8C564B", "#F1CE63", "#59A14F", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#B07AA1", "#882255")) +c4a_twilight13 = list(twilight13a = c("#A5170E", "#FF9D9A", "#8C564B", "#997700", "#F1CE63", "#AAAA00", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight13b = c("#A5170E", "#FF9D9A", "#8C564B", "#997700", "#AAAA00", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#FABFD2", "#E73F74"), + twilight13c = c("#FF9D9A", "#8C564B", "#997700", "#F1CE63", "#AAAA00", "#225522", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight13d = c("#FF9D9A", "#8C564B", "#997700", "#AAAA00", "#225522", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#FABFD2", "#E73F74"), + twilight13e = c("#A5170E", "#FF9D9A", "#8C564B", "#997700", "#DDCC77", "#AAAA00", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight13f = c("#FF9D9A", "#8C564B", "#997700", "#DDCC77", "#AAAA00", "#225522", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74")) + +m = matrix(0L, nrow = 20, ncol = 23) +tpals = c(c4a_twilight5, c4a_twilight7, c4a_twilight9, c4a_twilight11, c4a_twilight13) +tlst = list(c4a_twilight5, c4a_twilight7, c4a_twilight9, c4a_twilight11, c4a_twilight13) + + +for (i in 1:length(tpals)) m[i, match(tpals[[i]], pool_cvd)] = 1L + +find_matches = function(x, y) { + nx = length(x) + ny = length(y) + + sapply(1:nx, function(i) { + sapply(1:ny, function(j) { + length(intersect(x[[i]], y[[j]])) + }) + }) + +} + +tpals = c(c4a_twilight5, c4a_twilight7, c4a_twilight9, c4a_twilight11, c4a_twilight13) + +tn = sapply(tlst, length) + +tcomb = do.call(expand.grid, lapply(tn, seq, from = 1)) + +score = apply(tcomb, MARGIN = 1, function(ti) { + res = lapply(1:length(ti), function(i) { + tlst[[i]][[ti[i]]] + }) + length(unique(unlist(res))) + + # y = combn(length(ti), 2) + # z = apply(y, MARGIN = 2, function(yi) { + # length(intersect(res[[yi[1]]], res[[yi[2]]])) + # }) + # sum(z) +}) + +mx = which(score == min(score)) + + +tcomb[mx, ] + + +ids = c(296, 299, 323, 371) +ids2 = which(score <= 16) +ids3 = c(296, 55) + + + +score[c(323, 371)] + +get_pals = function(i) { + ind = as.integer(tcomb[i, ]) + lapply(1:length(ind), function(j) { + tlst[[j]][[ind[[j]]]] + }) +} + +get_pool = function(i) { + pals = get_pals(i) + pool = pals |> + unlist() |> + unique() |> + colors_sort("H") +} + +pools = lapply(ids2, get_pool) +names(pools) = paste0("pool", ids2) + + +setdiff(pools$pool55, pools$pool296) +setdiff(pools$pool296, pools$pool55) +setdiff(pools$pool296, pools$pool7) +setdiff(pools$pool7, pools$pool296) + +c4a_plot(pools$pool7, nrows = 1) +c4a_plot(pools$pool296, nrows = 1) +c4a_plot(pools$pool55, nrows = 1) + + +c4a_load(c4a_data(pools, series = "cpools"), overwrite = TRUE) + +c4a_gui() + +create_c4a_data = function(i) { + pool = get_pool(i) + + ps = lapply(2:13, function(k) { + res = suppressMessages(colors_cbf_set(pool, k = k, step = 0, plot = FALSE)) + l = min(length(res$palettes), 15) + p = res$palettes[1:l] + names(p) = paste0("k", k, "_n", 1:l) + p + }) + pss = do.call(c, ps) + c4a_data(pss, series = paste0("c", i)) +} + + + +create_c4a_data_orig = function(i) { + pals = get_pals(i) + names(pals) = paste0("k", sapply(pals, length), "_orig") + c4a_data(pals, series = paste0("c", i, "_orig")) +} + +create_c4a_data_sel = function(i, sel) { + pool = get_pool(i) + + ps = lapply(2:13, function(k) { + res = suppressMessages(colors_cbf_set(pool, k = k, step = 0, plot = FALSE)) + res$palettes[[sel[k-1]]] + }) + pals = c(list(ps[[1]][1]), ps) + names(pals) = 1:13 + + ids = lapply(pals, function(p) { + match(p, pool) + }) + + #ids2 = c(ids, list(index14 = 2:15, index15 = 1:15)) + + + attr(pool, "index") = ids + + c4a_data(list(cbf = pool), series = paste0("c", i)) +} + +p = lapply(ids3, create_c4a_data) + +po = lapply(ids3, create_c4a_data_orig) + +ps = create_c4a_data_sel(296, c(14,3,12,5,1,1,2,3,1,2,3,1)) + + +lapply(po, c4a_load, overwrite = TRUE) + +lapply(p, c4a_load, overwrite = TRUE) +c4a_load(ps) +c4a_gui() + +str(p,1) + + + +create_index = function(i) { + pals = get_pals(i) + pool = pals |> + unlist() |> + unique() |> + colors_sort("H") + + colors_cbf_set(pool, k = 5, step = 0, dE_min = 20) + colors_cbf_set(pool, k = 7, step = 0, dE_min = 20) + colors_cbf_set(pool, k = 9, step = 0, dE_min = 20) + colors_cbf_set(pool, k = 11, step = 0, dE_min = 20) + colors_cbf_set(pool, k = 13, step = 0, dE_min = 20) + + + for (j in 1:5) c4a_plot(pals[[j]], nrows = 1) + + lapply(1:13, function(k) { + p = if (k < 5) { + pals[[1]][1:k] + } else + }) +} + + + +get_pals(296) |> + unlist() |> + unique() |> + colors_sort("H") |> + c4a_plot() + + + + + + +find_matches(c4a_twilight7, c4a_twilight13) + + + + + + + +res11 = colors_cbf_set(pool_cvd, k = 11) +res13 = colors_cbf_set(pool_cvd, k = 13) + + + + + + c_cat_names = c("carto.safe", "carto.bold", "tableau.classic20", "tableau.color_blind", "tableau.classic_color_blind", "tableau.20", "tol.muted", "tol.light", "tol.vibrant", "tol.medium", "tol.dark", "tol.rainbow") c_cat_list = lapply(c_cat_names, c4a) -pool = unlist(c_cat_list) - -sel = pool |> +pool5 = unlist(c_cat_list) |> unique() |> - colors_filter(CRWmin = 1.5, CRWmax = 14, Cmin = 40) |> #, Cmin = 30, Lmin = 40, Cmax = 110 + colors_filter(CRWmin = 1.5, Cmin = 34, CRWmax = 9) |> #, Cmin = 30, Lmin = 40, Cmax = 110 colors_sort("H") |> - colors_remove_twins(th = 3) + colors_remove_twins(th = 3, include.cvd = F) + + + + +init5 = colors_cbf_set(pool5, k = 5, dE_min = 18, parallelize = FALSE, step = -1) +res5 = colors_cbf_set(init = init5, step = 1) + +saveRDS(res5, file = "build/res5.rds") + +pals=structure(res5$palettes, names = paste0("pal", 1:length(res5$palettes))) + + + +pool7 = unlist(pals) |> + unique() |> + colors_sort("H")|> + colors_remove_twins(th = 6) +c4a_plot(pool7) + +# attempt 1: 9: 12.42, 11: 9.94 + +saveRDS(pool7, file = "temp/pool7.rds") + +pool7 = readRDS("temp/pool7.rds") + +init7 = colors_cbf_set(pool7, k = 7, dE_min = 10, parallelize = FALSE, step = -1) + +res7 = colors_cbf_set(init = init7, step = 1) +saveRDS(res7, file = "build/res7.rds") + + +pool9 = unlist(res7$palettes[1:250]) |> + unique() |> + colors_sort("H") +saveRDS(pool9, file = "temp/pool9.rds") + +init9 = colors_cbf_set(pool9, k = 9, dE_min = 10) +res9 = colors_cbf_set(init = init9, step = 1) +saveRDS(res9, file = "build/res9b.rds") # 3 hours # pool9 = 41 + + +pool11 = unlist(res9$palettes[1:29]) |> + unique() |> + colors_sort("H") + +c4a_plot(pool11) +c4a_plot(pool_twilight) + +init11 = colors_cbf_set(pool11, k = 11, dE_min = 10) +res11 = colors_cbf_set(init = init11, step = 1) + +res11 = colors_cbf_set(init = init9, step = 1) -c4a_plot(sel) -############# -res5 = colors_cbf_set(sel, k = 5, dE_min = 20) -pals = res5$palettes -names(pals) = paste0("pal", 1:length(pals)) -pals_sel = pals[seq(1, length(pals), length.out = 500)] +identical(pool11, pool_twilight) + +res9$dE[1] + +res11 = colors_cbf_set(pool9, k = 11, dE_min = 10) +saveRDS(res9, file = "build/res9.rds") +saveRDS(res11, file = "build/res11.rds") + +# attempt 2: 9: , 11: + +res7 = colors_cbf_set(pool7, k = 7, dE_min = 10) +saveRDS(res7, file = "build/res7.rds") + +pals7=structure(res7$palettes, names = paste0("pal", 1:length(res7$palettes))) + + +pool9 = unlist(pals7) |> + unique() |> + colors_sort("H") + +res9 = colors_cbf_set(pool9, k = 9, dE_min = 15) +res11 = colors_cbf_set(pool9, k = 11, dE_min = 10) +saveRDS(res9, file = "build/res9.rds") +saveRDS(res11, file = "build/res11.rds") + + +pals3=structure(res$palettes, names = paste0("pal", 1:length(res$palettes))) + + +res = colors_cbf_set(sel2, k = 9, dE_min = 15) +pals3=structure(res$palettes, names = paste0("pal", 1:length(res$palettes))) c4a_sysdata_remove(series = "c4b") -c4a_load(c4a_data(pals_sel, series = "c4b")) +c4a_load(c4a_data(pals3, series = "c4b")) + + +c4a_sysdata_remove(series = "c4b") +c4a_load(c4a_data(pals7, series = "c4b")) + +c4a_gui() + + + + +########## old attempt + +c4a_day = list(day5 = c("#FF9D9A", "#F1CE63", "#59A14F", "#99DDFF", "#B07AA1"), + day7 = c("#CC6677", "#FF9D9A", "#F1CE63", "#AAAA00", "#99DDFF", "#77AADD", "#B07AA1"), + day9 = c("#CC6677", "#FF9D9A", "#DDCC77", "#AAAA00", "#59A14F", "#99DDFF", "#77AADD", "#B07AA1", "#FABFD2")) +c4a_night7 = list(night7a = c("#A5170E", "#8C564B", "#999933", "#009988", "#4B4B8F", "#9467BD", "#E73F74"), + night7b = c("#A5170E", "#E65518", "#9D7660", "#6195CF", "#3969AC", "#882255", "#D37295"), + night7c = c("#A5170E", "#997700", "#009988", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + night7d = c("#E65518", "#9D7660", "#225522", "#6195CF", "#4B4B8F", "#882255", "#D37295")) +c4a_night9 = list(night9a = c("#A5170E", "#E65518", "#8C564B", "#9D7660", "#009988","#4B4B8F", "#9467BD", "#882255", "#D37295"), + night9b = c("#A5170E", "#8C564B", "#9D7660", "#999933", "#009988", "#4B4B8F", "#9467BD","#882255", "#D37295"), + night9c = c("#A5170E", "#8C564B", "#997700", "#009988", "#4B4B8F", "#9467BD", "#882255", "#D37295", "#E73F74"), + night9d = c("#A5170E", "#8C564B", "#999933", "#009988", "#4B4B8F", "#9467BD", "#882255", "#D37295", "#E73F74"), + night9e = c("#E65518", "#8C564B", "#9D7660", "#225522", "#009988", "#4B4B8F", "#9467BD", "#882255", "#D37295"), + night9f = c("#8C564B", "#9D7660", "#999933", "#225522", "#009988", "#4B4B8F", "#9467BD", "#882255", "#D37295"), + night9g = c("#8C564B", "#997700", "#225522", "#009988", "#4B4B8F", "#9467BD", "#882255", "#D37295", "#E73F74"), + night9h = c("#8C564B", "#999933", "#225522", "#009988", "#4B4B8F", "#9467BD", "#882255", "#D37295", "#E73F74")) +c4a_night5 = list(night5a = c("#997700", "#6195CF", "#3969AC", "#882255", "#E73F74"), + night5b = c("#999933", "#225522", "#3969AC", "#882255", "#D37295"), + night5c = c("#E65518", "#225522", "#6195CF", "#3969AC", "#882255")) +c4a_twilight7 = list(twilight7a = c("#DDCC77", "#999933", "#225522", "#77AADD", "#3969AC", "#882255", "#D37295"), + twilight7b = c("#F1CE63", "#59A14F", "#225522", "#99DDFF", "#9467BD", "#882255", "#D37295"), + twilight7c = c("#FF9D9A", "#AAAA00", "#225522", "#99DDFF", "#3969AC", "#882255", "#E73F74"), + twilight7d = c("#E65518", "#F1CE63", "#225522", "#009988", "#99DDFF", "#9467BD", "#882255")) +c4a_twilight9 = list(twilight9a = c("#FF9D9A", "#997700", "#AAAA00", "#225522", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight9b = c("#A5170E", "#997700", "#AAAA00", "#009988", "#4B4B8F", "#9467BD", "#882255", "#FABFD2", "#E73F74"), + twilight9c = c("#F1CE63", "#999933", "#225522", "#009988", "#99DDFF", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight9d = c("#A5170E", "#997700", "#F1CE63", "#009988", "#99DDFF", "#4B4B8F", "#9467BD", "#882255", "#E73F74")) +c4a_twilight5 = list(twilight5a = c("#A5170E", "#F1CE63", "#009988", "#99DDFF", "#4B4B8F"), + twilight5b = c("#CC6677", "#F1CE63", "#225522", "#99DDFF", "#9467BD"), + twilight5c = c("#CC6677", "#A5170E", "#AAAA00", "#77AADD", "#3969AC")) +c4a_twilight11 = list(twilight11a = c("#CC6677", "#FF9D9A", "#997700", "#F1CE63", "#AAAA00", "#225522", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255"), + twilight11b = c("#FF9D9A", "#F1CE63", "#AAAA00", "#225522", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#B07AA1", "#882255", "#E73F74"), + twilight11c = c("#A5170E", "#FF9D9A", "#8C564B", "#F1CE63", "#59A14F", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#B07AA1", "#882255")) +c4a_twilight13 = list(twilight13a = c("#A5170E", "#FF9D9A", "#8C564B", "#997700", "#F1CE63", "#AAAA00", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight13b = c("#A5170E", "#FF9D9A", "#8C564B", "#997700", "#AAAA00", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#FABFD2", "#E73F74"), + twilight13c = c("#FF9D9A", "#8C564B", "#997700", "#F1CE63", "#AAAA00", "#225522", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight13d = c("#FF9D9A", "#8C564B", "#997700", "#AAAA00", "#225522", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#FABFD2", "#E73F74"), + twilight13e = c("#A5170E", "#FF9D9A", "#8C564B", "#997700", "#DDCC77", "#AAAA00", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74"), + twilight13f = c("#FF9D9A", "#8C564B", "#997700", "#DDCC77", "#AAAA00", "#225522", "#009988", "#99DDFF", "#77AADD", "#4B4B8F", "#9467BD", "#882255", "#E73F74")) + + +### old pool used to make twilight palettes +pool_twilight = unlist(c(c4a_twilight5,c4a_twilight7,c4a_twilight9,c4a_twilight11,c4a_twilight13)) |> + unique() |> + colors_sort("H") + + + + +sapply(c4a_twilight7, function(x) { + sapply(c4a_twilight13, function(y) { + all(x %in% y) + }) + +}) + + + +c4 = c(c4a_day, c4a_night5, c4a_night7, c4a_night9, c4a_twilight5, c4a_twilight7, c4a_twilight9, c4a_twilight11, c4a_twilight13) + +# example HCL and CR +# pool = unlist(c4) |> +# unique() |> +# colors_sort("H") +# +# pool |> +# colors_name("C") |> +# c4a_plot() + + +c4a_sysdata_remove(series = "c4c") +c4a_load(c4a_data(c4, series = "c4c"), overwrite = TRUE) -c4a_load(c4a_data(pals, series = "c4b")) +################################ +c4a = list(area7 = c("#FF9D9A", "#77AADD", "#F1CE63", "#2CA02C", "#B07AA1", "#9EDAE5", "#CC6677"), + area8 = c("#CC6677", "#AEC7E8", "#44BB99", "#B07AA1", "#BBCC33", "#FFAABB", "#B6992D", "#98DF8A"), + area9 = c("#EE8866", "#88CCEE", "#2CA02C", "#B07AA1", "#F1CE63", "#FFAABB", "#6699CC", "#44BB99", "#CC6677"), + area7d = c("#72190E", "#332288", "#225555", "#997700", "#437DBF", "#994F88", "#666633"), + area8d = c("#663333", "#1F77B4", "#225555", "#994F88", "#997700", "#332288", "#666633", "#661100"), + area9d = c("#72190E", "#1965B0", "#225555", "#994F88", "#997700", "#332288", "#666633", "#663333", "#437DBF"), + line7 = c("#1F77B4", "#2CA02C", "#E73F74", "#6699CC", "#994F88", "#117733", "#D37295"), + line8 = c("#DC050C", "#1F77B4", "#117733", "#994F88", "#999933", "#D37295", "#6699CC", "#E73F74"), + line9 = c("#EE3377", "#1F77B4", "#117733", "#CF1C90", "#999933", "#994455", "#6699CC", "#D37295", "#DC050C")) -c4a_gui(series = "c4b", n = 5) -########################## -c4a = list(area7 = area7, - area8 = area8, - area9 = area9, - area7d = area7d, - area8d = area8d, - area9d = area9d, - line7 = line7, - line8 = line8, - line9 = line9) +# +# c4a = list(area7 = area7, +# area8 = area8, +# area9 = area9, +# area7d = area7d, +# area8d = area8d, +# area9d = area9d, +# line7 = line7, +# line8 = line8, +# line9 = line9) -c4a_load(c4a_data(c4a2, series = "c4a2")) +c4a_load(c4a_data(c4a2, series = "c4a")) c4a_gui() diff --git a/build/build_palettes.R b/build/build_palettes.R index c799271..9fdd12b 100644 --- a/build/build_palettes.R +++ b/build/build_palettes.R @@ -833,10 +833,10 @@ local({ pals_bivg = list(bu_bivg = bu2, yl_rd_bivg = yl_rd, br_bivg = bu_br_biv[8:10], pu_bivg = pu_gn_biv[4:2], gn_bivg = pu_gn_biv[8:10]) - c4a_load(c4a_data(pals_div, types = "div", series = "c4a", space = "rgb")) - c4a_load(c4a_data(pals_bivs, types = "bivs", series = "c4a", biv.method = "div2seqseq", space = "rgb")) - c4a_load(c4a_data(pals_bivd, types = "bivd", series = "c4a", biv.method = "div2catseq", space = "rgb")) - c4a_load(c4a_data(pals_bivg, types = "bivg", series = "c4a", biv.method = "seq2uncseq", space = "rgb")) + c4a_load(c4a_data(pals_div, types = "div", series = "cols4all", space = "rgb")) + c4a_load(c4a_data(pals_bivs, types = "bivs", series = "cols4all", biv.method = "div2seqseq", space = "rgb")) + c4a_load(c4a_data(pals_bivd, types = "bivd", series = "cols4all", biv.method = "div2catseq", space = "rgb")) + c4a_load(c4a_data(pals_bivg, types = "bivg", series = "cols4all", biv.method = "seq2uncseq", space = "rgb")) pals2 = list(pinkgreen = pals::stevens.pinkgreen(n = 9), bluered = pals::stevens.bluered(n = 9), @@ -909,7 +909,7 @@ local({ line7 = c("#1F77B4", "#2CA02C", "#E73F74", "#6699CC", "#994F88", "#117733", "#D37295"), line8 = c("#DC050C", "#1F77B4", "#117733", "#994F88", "#999933", "#D37295", "#6699CC", "#E73F74"), line9 = c("#EE3377", "#1F77B4", "#117733", "#CF1C90", "#999933", "#994455", "#6699CC", "#D37295", "#DC050C")) - c4a_load(c4a_data(pals, types = "cat", series = "c4a")) + c4a_load(c4a_data(pals, types = "cat", series = "cols4all")) }) diff --git a/inst/www/light.css b/inst/www/light.css index b3326c3..bf752da 100644 --- a/inst/www/light.css +++ b/inst/www/light.css @@ -50,11 +50,23 @@ input[type="checkbox"], input[type="radio"] { div.checkbox { padding: 0px; margin: 0px;} -h4 { - margin-bottom: 6px !important; -} .control-label { + margin-top: 0px !important; + font-size: 120% !important; + line-height: 1.1 !important; + font-weight: 700 !important; +} + +.control-label2 { + margin-bottom: 5px !important; + font-size: 120% !important; + line-height: 1.1 !important; + font-weight: 700 !important; +} + +.control-label3 { + margin-top: 10px !important; font-size: 120% !important; line-height: 1.1 !important; font-weight: 700 !important;