Change the font of a DatePicker
It is not good to Customise the UIDatePicker
Although it is suggested to use the Native(Default) UIDatePicker
of the Swift,
then also if anyone wants you can refer the following list
Following are some of the Customisable Datepicker
from GitHub.
- https://github.com/squimer/DatePickerDialog-iOS-Swift
- https://github.com/itsmeichigo/DateTimePicker
- https://github.com/hsylife/SwiftyPickerPopover
- https://github.com/EngrAhsanAli/AAPickerView
- https://github.com/dillidon/alerts-and-pickers
- https://github.com/hughbe/day-date-picker
- https://github.com/alikaragoz/AIDatePickerController
- https://github.com/CooperRS/RMDateSelectionViewController
- https://github.com/zhhlmr/ZHDatePicker
- https://github.com/GasimGasimzada/FxDatePicker
- https://github.com/anatoliyv/SMDatePicker
- https://github.com/MarioIannotta/MIDatePicker
Note: But yes do not Try to customise The appearance of
UIDatePicker
.As it might make a danger of rejection of your app in
future.
Hope this helps.
Changing font color of Date Picker with inline style
There is no way to change inline
styled Date Picker text color in UIKit
14, but here is a workaround you can try:
Override style
I noticed that if you change the theme of the device (between light and dark), the text color of the .inline
date picker is changing.
So for example if you want a dark-text date picker in dark theme, you can override it:
myDatePicker.overrideUserInterfaceStyle = .light
Heres a image of the result
I will keep this post updated if there is any new way to change to any color.
How can I change font size of the dates within the datepicker (SwiftUI)
You can apply a .transformEffect(.init(scaleX: 0.7, y: 0.7))
:
var body: some View {
ZStack {
Color(.purple).edgesIgnoringSafeArea(.all)
VStack {
Section {
DatePicker("Event Date", selection: $eventDate, in: ...Date())
.labelsHidden()
.transformEffect(.init(scaleX: 0.7, y: 0.7))
}
}
}
}
How to change the font color of month and year picker in jquery datepicker?
Problem : There is white color in month & year drop down list in jQuery UI datepicker
Solution :
- jQuery UI's default
color
is#333
for Year & Month drop down, so here it is 100% change, that some other class is overwriting that defaultcolor
You need to change
.ui-datepicker select.ui-datepicker-month
and.ui-datepicker select.ui-datepicker-year
color to as per your
requirement likecolor:#000!important;
Make sure this newly written class must applied only after jQuery UI css file imported.
Use developer toolbar to verify that new css is applying or overwriting by something else.
Check below example, Year and Month's drop down color is changed by red using css only:
$( function() { $( "#datepicker" ).datepicker({ changeMonth: true, changeYear: true }); } );
.ui-datepicker select.ui-datepicker-month,.ui-datepicker select.ui-datepicker-year { color:red!important;}
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <P>Click on the textbox, see that Month & Year drop down color is changed!</p> <input type="text" id="datepicker">
Change font color in new DatePicker (iOS14)
I don't have your colors but the following should work.
Tested with Xcode 12.1 / iOS 14.1
VStack (alignment: .center, spacing: 0)
{
DatePicker(selection: self.$enddate, in: self.endMinDate()...self.endMaxDate()) {
Text("Start")
}.labelsHidden()
}
.accentColor(MyColor.bluecolor) // << this one !!
//.accentColor(.red) // << used for demo
MUI DatePicker default textfield cannot be customized with different font color and size
All you had to do was inspect the text, copy the applicable classname and apply classes.root directly to .
const useStyles = makeStyles({
root: {
"& .MuiOutlinedInput-input": {
border: 0,
borderRadius: 3,
color: "red",
fontSize: 24
}
}
});
const DateSettings() {
const classes = useStyles();
const [value, setValue] = useState(Date | (null > null));
return (
<Box>
<LocalizationProvider dateAdapter={AdapterDateFns}>
<Stack spacing={3}>
<MobileDatePicker
inputFormat="MM/dd/yyyy"
value={value}
onChange={handleChange}
components={{ OpenPickerIcon: CalendarIcon }}
renderInput={(params) => <TextField className={classes.root} {...params} />}
/>
</Stack>
</LocalizationProvider>
</Box>
);
}
Change fontcolor of DatePicker Android
EDIT2: This works. (Added divider color)
Your XML
<DatePicker
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/datePicker"
android:calendarViewShown="false"
android:spinnersShown="true"
android:datePickerMode="spinner"
android:layout_below="@+id/tb_register_last_name"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/bt_register_tostep3"
android:layout_alignEnd="@+id/bt_register_tostep3"
android:theme="@style/MyDatePicker"/>
In styles.xml, set this (copy-paste the code)
<style name="MyDatePicker" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorControlNormal">#00FF00</item>
<item name="colorControlActivated">#00FF00</item>
<item name="android:textColorPrimary">#FF0000</item>
</style>
Google materialdoc will be helpful for you in the future.
Change your style and let me know if it works!!
Related Topics
Swift:Pause and Resume Nstimer
Textfield in Swiftui Loses Focus When I Enter a Character
How to Use Nsvisualeffectview to Blend Window with Background
Zposition of Sknode Relative to Its Parent
How to Skip Iterations of a For-In Loop (Swift 3)
Swift - Exit Outer Function from Closure
Modifying an Array Passed as an Argument to a Function in Swift
How to Set the iOS13 Uisegmentedcontrol Backgroundcolor to White
Swift Firestore Check If Documents Exists
Using @Discardableresult for Closures in Swift
Left Aligned Horizontal Stackview and Top Aligned Vertical Stackview
Swift - Getting Only Alphanumeric Characters from String
Swift Language Statically or Dynamically Dispatched
Generic Method Override Not Working in Swift
Send Mail with File Attachment
How to Move Application's Window Between Virtual Desktops in Os X
Firebase Crashlytics Not Showing Crash Report in Console Dashboard Swift