Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color Layouts #89

Open
AaronVerDow opened this issue Feb 24, 2021 · 0 comments
Open

Color Layouts #89

AaronVerDow opened this issue Feb 24, 2021 · 0 comments

Comments

@AaronVerDow
Copy link

key_colors

I was having trouble deciding what colors to print keys in and decided it might be worth to try a color layout. The example below is quick and dirty but should let anyone play around with the idea. I'm not quite sure how a merge-worthy feature should be approached. Key labels do get very hard to read so it might be worth passing the colors down to lower levels so the individual parts of a keycap can be colored slightly differently.

diff --git a/src/layouts/layout.scad b/src/layouts/layout.scad
index cd3c9c2..f371b6d 100644
--- a/src/layouts/layout.scad
+++ b/src/layouts/layout.scad
@@ -20,7 +20,7 @@ function double_sculpted_column(column, row_length, column_sculpt_profile) =
         1hand(column, row_length) : (column_sculpt_profile == "cresting_wave") ?
           cresting_wave(column, row_length) : 0;
 
-module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef) {
+module layout(list, profile="dcs", legends=undef, front_legends=undef, color_legends=undef, row_sculpting_offset=0, row_override=undef, column_sculpt_profile="2hands", column_override=undef) {
   for (row = [0:len(list)-1]){
     /* echo("**ROW**:", row); */
     row_length = len(list[row]);
@@ -36,7 +36,8 @@ module layout(list, profile="dcs", legends=undef, front_legends=undef, row_sculp
       // supports negative values for nonexistent keys
       if (key_length >= 1) {
         translate_u(column_distance - (key_length/2), -row) {
-        
+          
+          color(color_legends ? color_legends[row][column] : "") 
           key_profile(profile, row_sculpting, column_value) u(key_length) legend(legends ? legends[row][column] : "") front_legend(front_legends ? front_legends[row][column] : "") cherry() { // (row+4) % 5 + 1
           $row = row;
           $column = column;

Example layout:

include <../layout.scad>

60_percent_default_layout = [
  [1,1,1,1,1,1,1,1,1,1,1,1,1,2],
  [1.5,1,1,1,1,1,1,1,1,1,1,1,1,1.5],
  [1.75,1,1,1,1,1,1,1,1,1,1,1,2.25],
  [2.25,1,1,1,1,1,1,1,1,1,1,2.75],
  [1.25,1.25,1.25,6.25,1.25,1.25,1.25,1.25]
];

home="crimson";
letters="#222222";
numbers="gray";
space=numbers;
other="saddlebrown";
shift=other;
non_letters="purple";
ctrl=other;
alt=ctrl;
fn="goldenrod";

60_percent_color_legends = [
  [other, numbers, numbers, numbers, numbers, numbers, numbers, numbers, numbers, numbers, numbers, non_letters, non_letters, other],
  [other, letters, letters, letters, letters, letters, letters, letters, letters, letters, letters, non_letters, non_letters, non_letters],
  [other, home, home, home, home, letters, letters, home, home, home, home, non_letters, other],
  [shift, letters, letters, letters, letters, letters, letters, letters, non_letters, non_letters, non_letters, shift],
  [ctrl, fn, alt, space, alt, fn, fn, ctrl],
];

module 60_percent_default(profile) {
  layout(60_percent_default_layout, profile, [], [], 60_percent_color_legends) children();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant