-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feature: add placeholderText theme color for input placeholders (resolves #5088) #5133
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
base: dev
Are you sure you want to change the base?
Conversation
Fixes sst#5088 by adding a new optional \`placeholderText\` theme color that allows customizing the color of placeholder text in input fields and textareas. Changes: - Add \`placeholderText\` to ThemeColors type with fallback to \`textMuted\` - Apply \`placeholderColor\` prop to <input> components in dialog-select - Apply styled placeholder text to <textarea> components in dialog-prompt and prompt - Update JSON schemas to include \`placeholderText\` property - Maintain backward compatibility - existing themes work unchanged The new field follows ariane-emory's suggestion and provides a minimal, focused solution for theming placeholder text.
|
The main input textarea also needs this treatment: diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
index 7d5bbb9f0..1b13264df 100644
--- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
+++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx
@@ -656,7 +656,7 @@ export function Prompt(props: PromptProps) {
flexGrow={1}
>
<textarea
- placeholder={props.sessionID ? undefined : `Ask anything... "${PLACEHOLDERS[store.placeholder]}"`}
+ placeholder={props.sessionID ? undefined : t`${fg(theme.placeholderText)(`Ask anything... "${PLACEHOLDERS[store.placeholder]}"`)}`}
textColor={theme.text}
focusedTextColor={theme.text}
minHeight={1} |
|
Also, do you think it would be better to add a |
…opencode into fix/placeholder-color-5088
|
@b0o Addressed your first comment, that part should be good now. I'm going to have to spend a little more time thinking and investigating to come up with an answer I can feel confident in to the question in your latter comment and it's already getting very late here, so I'm going to need to sleep on it and get back to you tomorrow. |
- Update TextareaOptions interface to include optional placeholderColor field - Add _placeholderColor private field and getter/setter methods to TextareaRenderable - Modify constructor to initialize placeholderColor with fallback to #666666 - Update applyPlaceholder method to use placeholderColor instead of hardcoded fg(#666666) - Update OpenCode components to use new placeholderColor prop instead of t/fg template functions - Remove unused t, fg imports from dialog-prompt and prompt components This enables consistent placeholder color theming across all input components using the same prop-based API pattern
- Remove t, fg imports from DialogPrompt and Prompt components - Change textarea components to use placeholderColor prop instead of t/fg template functions - This leverages the new placeholderColor prop added to opentui Textarea component - Provides consistent API pattern matching Input component's placeholderColor usage
…opencode into fix/placeholder-color-5088
Resolves #5088.
This PR adds a new, optional
placeholderTexttheme color that allows customizing the color of placeholder text in input fields and textareas. There is no change in beheaviour for users who do not choose to use this new theme property: If theplaceholderTextproperty is not used, the existing behaviour of usingtextMutedis maintained.Changes:
placeholderTextto ThemeColors type with fallback totextMutedplaceholderColorprop to components in dialog-selectplaceholderTextpropertyTo use:
Simply include a line resembling the following to your theme file: