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

Add a "Selenized" color scheme and width adjustment option in prefs #30

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

jp-x-g
Copy link

@jp-x-g jp-x-g commented Feb 8, 2024

This adds an additional color scheme, Selenized (which is essentially Solarized with some contrast enhancements). It also formats some of the whitespace in the properties for color schemes, which I found useful when going through and modifying this one, and would probably be useful for the rest as well.

Also adds prefs option to change width of the text box from default of 35em

test adding a new color scheme
!
!
Add an option to the popup preferences window that allows adjusting the width of the main prompt/completion container; buttons allow increase/decrease by 1em or 5em at a time.
@jp-x-g
Copy link
Author

jp-x-g commented Feb 9, 2024

Also added an option in the preferences menu for the width of the prompt box; default is 35em, but now it can be widened or slimmed by clicking kawaii buttons (either 1em at a time or 5em).

@jp-x-g jp-x-g changed the title Add a "Selenized" color scheme Add a "Selenized" color scheme and width adjustment option in prefs Feb 9, 2024
Comment on lines -26 to +179
html.nockoffAI body {
background: var(--color-prompt-area)
background: var(--color-prompt-area)
}
html.selenized {
---color-bg-dark: #103C48;
--color-bg: #103C48;
--color-text: #CAD8D9;
--color-base-0: #CAD8D9;
--color-base-10: color-mix(in oklch, var(--color-base-100) 10%, var(--color-base-0));
--color-base-20: color-mix(in oklch, var(--color-base-100) 20%, var(--color-base-0));
--color-base-30: color-mix(in oklch, var(--color-base-100) 30%, var(--color-base-0));
--color-base-40: color-mix(in oklch, var(--color-base-100) 40%, var(--color-base-0));
--color-base-50: color-mix(in oklch, var(--color-base-100) 50%, var(--color-base-0));
--color-base-60: color-mix(in oklch, var(--color-base-100) 60%, var(--color-base-0));
--color-base-70: color-mix(in oklch, var(--color-base-100) 70%, var(--color-base-0));
--color-base-80: color-mix(in oklch, var(--color-base-100) 80%, var(--color-base-0));
--color-base-90: color-mix(in oklch, var(--color-base-100) 90%, var(--color-base-0));
--color-base-100: #103C48;
--color-base-150: #081e24;
--color-dark: var(--color-base-100);
--color-light: #CAD8D9;
--color-input: #FA5750;
--color-sidebar: var(--color-base-100);
--color-prompt-area: #CAD8D9;
--color-hover: #4695F7;
--color-button: #75B938;
--color-disabled: #72898F;
--color-button-hover: #DBB32D;

--token-prob-box: #FF665C;

font-family: "Source Sans Pro", "Helvetica Neue", sans-serif;
font-size: 15.5px;

accent-color: var(--color-base-90);
background: var(--color-bg-dark);
color: var(--color-base-0);
color-scheme: dark;
}

html.selenized body {
background: var(--color-base-150)
}

html.selenized #sidebar {
background: var(--color-base-100)
}

html.monospace-dark {
---color-bg-dark: #282833;
--color-bg: #202020;
--color-text: #bababa;
--color-base-0: oklch(77.65% 0.0752 285.22);
--color-base-10: color-mix(in oklch, var(--color-base-100) 90%, var(--color-base-0));
--color-base-20: color-mix(in oklch, var(--color-base-100) 80%, var(--color-base-0));
--color-base-30: color-mix(in oklch, var(--color-base-100) 70%, var(--color-base-0));
--color-base-40: color-mix(in oklch, var(--color-base-100) 60%, var(--color-base-0));
--color-base-50: color-mix(in oklch, var(--color-base-100) 50%, var(--color-base-0));
--color-base-60: color-mix(in oklch, var(--color-base-100) 40%, var(--color-base-0));
--color-base-70: color-mix(in oklch, var(--color-base-100) 30%, var(--color-base-0));
--color-base-80: color-mix(in oklch, var(--color-base-100) 20%, var(--color-base-0));
--color-base-90: color-mix(in oklch, var(--color-base-100) 10%, var(--color-base-0));
--color-base-100: oklch(24.28% 0.015 285.22);
--color-dark: var(--color-base-100);
--color-light: var(--color-base-0);
--token-prob-box: #4a4a4a;

font-family: monospace;
font-size: 15px;

accent-color: var(--color-base-30);
background: var(--color-bg-dark);
color: var(--color-base-0);
color-scheme: dark;
---color-bg-dark: #282833;
--color-bg: #202020;
--color-text: #bababa;
--color-base-0: oklch(77.65% 0.0752 285.22);
--color-base-10: color-mix(in oklch, var(--color-base-100) 90%, var(--color-base-0));
--color-base-20: color-mix(in oklch, var(--color-base-100) 80%, var(--color-base-0));
--color-base-30: color-mix(in oklch, var(--color-base-100) 70%, var(--color-base-0));
--color-base-40: color-mix(in oklch, var(--color-base-100) 60%, var(--color-base-0));
--color-base-50: color-mix(in oklch, var(--color-base-100) 50%, var(--color-base-0));
--color-base-60: color-mix(in oklch, var(--color-base-100) 40%, var(--color-base-0));
--color-base-70: color-mix(in oklch, var(--color-base-100) 30%, var(--color-base-0));
--color-base-80: color-mix(in oklch, var(--color-base-100) 20%, var(--color-base-0));
--color-base-90: color-mix(in oklch, var(--color-base-100) 10%, var(--color-base-0));
--color-base-100: oklch(24.28% 0.015 285.22);
--color-dark: var(--color-base-100);
--color-light: var(--color-base-0);
--token-prob-box: #4a4a4a;

font-family: monospace;
font-size: 15px;

accent-color: var(--color-base-30);
background: var(--color-bg-dark);
color: var(--color-base-0);
color-scheme: dark;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code is a bit misaligned in some places:
image

Also, I'm not totally sold on these stylistic changes, but they're not too bad either, so I guess they're okay to keep if you really want them.

Comment on lines -370 to -372
html.monospace-dark .modal {
background: #282833;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the merge with the upstream wasn't done properly.

@@ -1145,6 +1223,7 @@
options.dynamic_temperature = true;
options.dynatemp_low = Math.max(0, options.temperature - options.dynatemp_range);
options.dynatemp_high = Math.max(0, options.temperature + options.dynatemp_range);
delete options.dynatemp_range;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another merge issue

@@ -1778,7 +1875,7 @@
maxPredictTokens: -1,
temperature: 0.7,
dynaTempRange: 0,
dynaTempExp: 1,
dynaTempExp: 0,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another merge issue

Comment on lines +2884 to +2891
${endpointAPI != 0 && html`
<div className="hbox">
<${InputBox} label="DynaTemp Range" type="number" step="0.01"
readOnly=${!!cancel} value=${dynaTempRange} onValueChange=${setDynaTempRange}/>
${endpointAPI != 2 && html`
<${InputBox} label="DynaTemp Exp" type="number" step="0.01"
readOnly=${!!cancel} value=${dynaTempExp} onValueChange=${setDynaTempExp}/>`}
</div>`}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another merge issue

Comment on lines +1596 to +1611
function onLoad() {
// Any other general task we want to do when the page is loaded.
setTimeout(() => {
try {
document.getElementById("prompt-container").style.maxWidth = "36em";
// You can't actually get the width from the element unless you do some
// stupid workaround like "get the computed width in pixels, get the
// font size, do math on pixels, and convert to em". Instead, we'll just
// manually set it to be "36em" so it can be interacted with by the modal.

// document.getElementsByClassName("modal-width-readout")[0].value = "36";
} catch(e) {
reportError(e);
}
}, 1000);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels wrong, you should do this with React's useEffect instead, and also you should load the value from the persistent state.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indeed a stupid hack. I can make a go at using React to do this more elegantly than just plain JS.

Comment on lines +3072 to +3079
<div className="modal-width-adjustment">
<span>Box width: </span>
<button onClick=${() => adjustWidth(-5)}>⟪</button>
<button onClick=${() => adjustWidth(-1)}>⟨</button>
<input type="text" value="35" id="modal-width-readout" readOnly />
<button onClick=${() => adjustWidth( 1)}>〉</button>
<button onClick=${() => adjustWidth( 5)}>⟫</button>
</div>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please allow the manual change of the input value and use a react state as I commented before.
Also, a button you can optionally hold down is better than simply having another button for larger increments.

Comment on lines +2376 to +2385
function adjustWidth(adjustment) {

var width = document.getElementById("prompt-container").style.maxWidth.replace("em", "").trim();
width = String(parseInt(width) + parseInt(adjustment))
if (width < 1){
width = 1;
}
document.getElementById("prompt-container").style.maxWidth = width + "em";
document.getElementById("modal-width-readout").value = width
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code doesn't work when the sidebar is attached to the prompt container.
Besides, it's important to also update the CSS rules within the media queries, such as: @media (min-width: calc(40.5em + 250px)). Here, 40.5em essentially equates to 36em multiplied by the fontSize, which is 1.125rem.

@lmg-anon
Copy link
Owner

lmg-anon commented Feb 9, 2024

There are some issues with the theme:
image

  • The session list is too bright.
  • The box width input doesn't use the correct color scheme.

@jp-x-g
Copy link
Author

jp-x-g commented Feb 11, 2024

Okay, I see -- I'll submit an updated patch that fixes this stuff (and hopefully that also resolves the random merge issues).

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

Successfully merging this pull request may close these issues.

2 participants