Skip to content

Commit

Permalink
TheShovel/CustomStyles: question label color, allow more custom gradi…
Browse files Browse the repository at this point in the history
…ents (#1250)

Co-authored-by: Muffin <[email protected]>
  • Loading branch information
SharkPool-SP and GarboMuffin authored Jan 28, 2024
1 parent 93fa5a3 commit 86d4068
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions extensions/TheShovel/CustomStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
let askInputBorderWidth = -1;
let askBoxIcon = "";
let askInputText = "";
let askQuestionText = "";
let askButtonImage = "";
let askInputBorder = "";

Expand All @@ -48,6 +49,7 @@
let askBoxBG;
let askBoxButton;
let askBoxInner;
let askBoxText;
let askBoxBorderMain;
let askBoxBorderOuter;
if (typeof scaffolding !== "undefined") {
Expand All @@ -63,6 +65,8 @@
askBoxBG = ".sc-question-inner";
askBoxButton = ".sc-question-submit-button";
askBoxInner = ".sc-question-input";
askBoxText =
'[class^="question_question-container_"] input[class^="question_question-label_"]';
askBoxBorderMain = ".sc-question-input:hover";
askBoxBorderOuter = ".sc-question-input:focus";
} else {
Expand All @@ -80,6 +84,8 @@
askBoxButton = 'button[class^="question_question-submit-button_"]';
askBoxInner =
'[class^="question_question-container_"] input[class^="input_input-form_"]';
askBoxText =
'[class^="question_question-container_"] div[class^="question_question-label_"]';
askBoxIcon = 'img[class^="question_question-submit-button-icon_"]';
askBoxBorderMain =
'[class^="question_question-input_"] input:focus, [class^="question_question-input_"] input:hover';
Expand Down Expand Up @@ -177,6 +183,9 @@
if (askInputText) {
css += `${askBoxInner} { color: ${askInputText} !important; }`;
}
if (askQuestionText) {
css += `${askBoxText} { color: ${askQuestionText} !important; }`;
}
if (askInputRoundness >= 0) {
css += `${askBoxInner} { border-radius: ${askInputRoundness}px !important; }`;
}
Expand Down Expand Up @@ -222,6 +231,7 @@
askInputBorderWidth = -1;
askBoxIcon = "";
askInputText = "";
askQuestionText = "";
askButtonImage = "";
askInputBorder = "";

Expand Down Expand Up @@ -280,8 +290,8 @@
return;
}

// Simple linear gradient
if (/^linear-gradient\(\d+deg,#?[a-z0-9]+,#?[a-z0-9]+\)$/.test(color)) {
// General gradient pattern
if (/^[a-z-]+-gradient\([a-z0-9,#%. ]+\)$/i.test(color)) {
callback(color);
return;
}
Expand Down Expand Up @@ -508,6 +518,7 @@
"ask prompt background",
"ask prompt button background",
"ask prompt input background",
"ask prompt question text",
"ask prompt input text",
"ask prompt input border",
],
Expand Down Expand Up @@ -550,6 +561,7 @@
"ask prompt background",
"ask prompt button background",
"ask prompt input background",
"ask prompt question text",
"ask prompt input text",
"ask prompt input border",
"monitor background border width",
Expand Down Expand Up @@ -595,6 +607,8 @@
askButtonBackground = color;
} else if (args.COLORABLE === "ask prompt input background") {
askInputBackground = color;
} else if (args.COLORABLE === "ask prompt question text") {
askQuestionText = color;
} else if (args.COLORABLE === "ask prompt input text") {
askInputText = color;
} else if (args.COLORABLE === "ask prompt input border") {
Expand Down Expand Up @@ -719,6 +733,8 @@
return askButtonBackground;
} else if (args.ITEM === "ask prompt input background") {
return askInputBackground;
} else if (args.ITEM === "ask prompt question text") {
return askQuestionText;
} else if (args.ITEM === "ask prompt input text") {
return askInputText;
} else if (args.ITEM === "ask prompt input border") {
Expand Down

0 comments on commit 86d4068

Please sign in to comment.