[APP][OPEN SOURCE][ROOT][5.0+] Night Light (KCAL)

Search This thread

corphish

Recognized Dev / Inactive Recognized Contributor
Apr 16, 2014
1,014
2,453
Durgapur
Night light is an open-source app which uses KCAL to adjust blue light intensity of the display colors, so that viewing the screen at dark becomes pleasant for the eyes, and help you fall asleep faster (this is what science have proven so...).

Features
  • Easy to use user interface. Settings are easier to find.
  • Uses KCAL to adjust screen RGB colors, hence its efficient and changes are seen everywhere on screen.
  • Supports older KCAL implementations as well as newer KCAL implementation for v4.4 kernels.
  • Simple color controls for normal users through color temperature control.
  • Manual KCAL controls for advanced users.
  • Automation routines lets you define routines where you specify Night Light settings which you wish to apply, and they will be automatically applied for you in specified times.
  • Intensity fading in/out is supported as part of automation routines.
  • Supports sunset/sunrise timings.
  • Set on boot delay.
  • Original KCAL settings of user is backed up and applied when night light is turned off. And it can be configured as well.
  • Support for user profiles, which are collections of settings that user can apply with one click.
  • And to fulfill your all kinds of automation needs, app is supported as a Tasker plugin. You can use it with Profiles.
  • Option to automatically disable Night Light in lock screen, and turn it back on after the device is unlocked.
  • Quick Setting tile for easy toggling on/off night light anywhere.
  • Launcher icon shortcut for toggling Night Light on/off and toggling intensities.
  • Dark and Light theme.

Advantages
  • No overlays.
  • Background service is only used for lock screen option. The entire automation (including the fading) is done using neat AlarmManager tricks (which not only is battery friendly, but memory friendly as well).

Requirements
  • Kernel supporting KCAL.
  • Root access.

Download


Source - https://github.com/corphish/NightLight
 
Last edited:

jerrystar

Member
May 3, 2011
8
1
sounds good

let me have a try brother......


Night light is an open-source app which uses KCAL to adjust blue light intensity of the display colors, so that viewing the screen at dark becomes pleasant for the eyes, and help you fall asleep faster (this is what science have proven so...).

Features
  • Easy one touch toggles, with a single slider to tweak blue light intensity.
  • Quick Setting tile for easy toggling on/off night light anywhere.
  • Automatic switching on/off night light at user specifed timings. (Limitation - Start time must be lesser in value than ending time, that is if you choose starting time at 2300 hrs and ending time at 0600 hrs (next day) it won't work for now).

Requirements
  • Kernel supporting KCAL.
  • Root access.

Download



Source - https://github.com/corphish/NightLight
 

rickysidhu_

Senior Member
  • Apr 1, 2016
    1,865
    785
    Vancouver
    OnePlus 9
    Loving the app so far, however, I notice it won't trigger at the time I have set unless I manually open the app. I've removed it from Android's battery optimization so I don't think that can be it. Any ideas?
     

    yochananmarqos

    Recognized Contributor
    Loving the app so far, however, I notice it won't trigger at the time I have set unless I manually open the app. I've removed it from Android's battery optimization so I don't think that can be it. Any ideas?
    Same here. I forgot to report it. I use Tasker to launch it at sunset & sunrise along with switching between dark / light app themes.

    Sent from my Nexus 6P using XDA Labs
     
    Last edited:

    J0kker

    Senior Member
    Mar 15, 2012
    411
    196
    Amazon Fire TV
    Google Pixel 4a 5G
    Can you explain whats this KCAL thing ??? [emoji848][emoji848]
    Kcal is a kernel tweak that lets you customize colors at lower (kernel) level, so there won't be any filter or layer on screen, but in most stock kernels it isn't available, so you have to find a custom kernel for your phone/rom that has it.

    Thanks for the app, but I've used tasker with the command "echo 180 75 35> /sys/devices/platform/kcal_ctrl.0/kcal" for a long time (echo 256 256 256 > /sys/devices/platform/kcal_ctrl.0/kcal to get the color back.)
    Obviously you can change the values to whatever you want.

    But the app will be much more easy for many people:)

    Envoyé de mon ONEPLUS A5000 en utilisant Tapatalk
     
    Kcal is a kernel tweak that lets you customize colors at lower (kernel) level, so there won't be any filter or layer on screen, but in most stock kernels it isn't available, so you have to find a custom kernel for your phone/rom that has it.

    I'm using LineageOS with a custom kernel which allows mein to change RGB values from any kernel modification app...


    Sent from my LG G2 using XDA Labs
     

    rickysidhu_

    Senior Member
  • Apr 1, 2016
    1,865
    785
    Vancouver
    OnePlus 9
    Kcal is a kernel tweak that lets you customize colors at lower (kernel) level, so there won't be any filter or layer on screen, but in most stock kernels it isn't available, so you have to find a custom kernel for your phone/rom that has it.

    Thanks for the app, but I've used tasker with the command "echo 180 75 35> /sys/devices/platform/kcal_ctrl.0/kcal" for a long time (echo 256 256 256 > /sys/devices/platform/kcal_ctrl.0/kcal to get the color back.)
    Obviously you can change the values to whatever you want.

    But the app will be much more easy for many people:)

    Envoyé de mon ONEPLUS A5000 en utilisant Tapatalk
    I tried the Tasker method and it works great. I had no idea that command existed and could be used in Tasker. Thank you for sharing! :good: :highfive:
     
    • Like
    Reactions: J0kker

    corphish

    Recognized Dev / Inactive Recognized Contributor
    Apr 16, 2014
    1,014
    2,453
    Durgapur
    Loving the app so far, however, I notice it won't trigger at the time I have set unless I manually open the app. I've removed it from Android's battery optimization so I don't think that can be it. Any ideas?

    Does it fail to trigger if a reboot had happened sometime before the time it should have triggered?
    For example, if it was to trigger at 5pm, but a device reboot happened in, say, 3pm, then does it fail to trigger at 5pm?

    Anyway, set on boot is broken (again), will need to fix it, but normal timers should work fine.
     

    rickysidhu_

    Senior Member
  • Apr 1, 2016
    1,865
    785
    Vancouver
    OnePlus 9
    Does it fail to trigger if a reboot had happened sometime before the time it should have triggered?
    For example, if it was to trigger at 5pm, but a device reboot happened in, say, 3pm, then does it fail to trigger at 5pm?

    Anyway, set on boot is broken (again), will need to fix it, but normal timers should work fine.
    Ahh, that might be it. I think it stops working after a reboot, so I'd be going back into the app to get it going again.

    Very minor issue though, great app - thank you for your hard work!!:highfive:
     

    jineshpatel30

    Senior Member
    Nov 8, 2012
    1,570
    1,176
    Does it fail to trigger if a reboot had happened sometime before the time it should have triggered?
    For example, if it was to trigger at 5pm, but a device reboot happened in, say, 3pm, then does it fail to trigger at 5pm?

    Anyway, set on boot is broken (again), will need to fix it, but normal timers should work fine.
    Launcher shortcut (toggle on/off) switch is also seems somewhat broken, it toggle on but fails to toggle off.
     

    corphish

    Recognized Dev / Inactive Recognized Contributor
    Apr 16, 2014
    1,014
    2,453
    Durgapur
    @jineshpatel30 @rickysidhu_

    Here is an experimental version (in the attachment of this reply), with launcher shortcut toggle and set on boot fixed.
    The reason why it is experimental :
    - Now written in kotlin
    - Uses some of the new stuff announced in I/O 18, like ktx and the new material design style
    - Uses different font called 'Acme'. (Feel free to suggest fonts)
    - I decided to ditch cards because normal layouts look better in this new style.

    Source - https://github.com/corphish/NightLight/tree/p
     

    Attachments

    • app-generic-release.apk
      2.5 MB · Views: 32

    yochananmarqos

    Recognized Contributor
    @[email protected]_

    Here is an experimental version (in the attachment of this reply), with launcher shortcut toggle and set on boot fixed.
    The reason why it is experimental :
    - Now written in kotlin
    - Uses some of the new stuff announced in I/O 18, like ktx and the new material design style
    - Uses different font called 'Acme'. (Feel free to suggest fonts)
    - I decided to ditch cards because normal layouts look better in this new style.

    Source - https://github.com/corphish/NightLight/tree/p
    It kicked in automagically at sunset tonight which reminded me to come back and comment. That was unreliable previously.

    What does the save button do at the bottom? I assume it saves something, but there's no toast message to acknowledge it's been pressed.

    I don't like the font, myself. Since you're going for new and fancy code and styling, why not use ProductSans? I like the new font used in the Wear OS app, I think that's it.

    Could you add the numerical values for the sliders for more accurate fine tuning? I like the way the new XDA Navigation Gestures app does it. It's in the latest beta posted in the thread and should be pushed to the Play Store soon.

    Since CF.lumen is EOL now, this app is going to be a great alternative especially when it eventually breaks.

    Thank you!

    Sent from my Nexus 6P using XDA Labs
     

    Top Liked Posts

    • There are no posts matching your filters.
    • 18
      Night light is an open-source app which uses KCAL to adjust blue light intensity of the display colors, so that viewing the screen at dark becomes pleasant for the eyes, and help you fall asleep faster (this is what science have proven so...).

      Features
      • Easy to use user interface. Settings are easier to find.
      • Uses KCAL to adjust screen RGB colors, hence its efficient and changes are seen everywhere on screen.
      • Supports older KCAL implementations as well as newer KCAL implementation for v4.4 kernels.
      • Simple color controls for normal users through color temperature control.
      • Manual KCAL controls for advanced users.
      • Automation routines lets you define routines where you specify Night Light settings which you wish to apply, and they will be automatically applied for you in specified times.
      • Intensity fading in/out is supported as part of automation routines.
      • Supports sunset/sunrise timings.
      • Set on boot delay.
      • Original KCAL settings of user is backed up and applied when night light is turned off. And it can be configured as well.
      • Support for user profiles, which are collections of settings that user can apply with one click.
      • And to fulfill your all kinds of automation needs, app is supported as a Tasker plugin. You can use it with Profiles.
      • Option to automatically disable Night Light in lock screen, and turn it back on after the device is unlocked.
      • Quick Setting tile for easy toggling on/off night light anywhere.
      • Launcher icon shortcut for toggling Night Light on/off and toggling intensities.
      • Dark and Light theme.

      Advantages
      • No overlays.
      • Background service is only used for lock screen option. The entire automation (including the fading) is done using neat AlarmManager tricks (which not only is battery friendly, but memory friendly as well).

      Requirements
      • Kernel supporting KCAL.
      • Root access.

      Download


      Source - https://github.com/corphish/NightLight
      5
      Beta 2.5

      A beta version (2.5) was released in XDA Labs (Beta channel) as well as Play Store (Beta channel), with changes mostly based on user feedback and some stuff of my own, as well as fixes. This is in no way a finalised version, as lots of development is going on, but the existing features should work.

      Great app, great Cf.lumen alternative!
      One thing would be nice if we can set sunset/sunrise GPS coordinations manually

      Sent from my OnePlus 5T using XDA Labs

      Nice idea!
      Will be implementing this as well as an option to re-detect location. Thanks!.

      Anyone know how to get location access all the time for the app in Android 10? I can only see allow only when using the app on my Pixel 4 XL.

      Location is not used everytime. It is used only once when you enable sunset/sunrise timings. On doing so, the location co-ordinates are stored and loaded when sunset and sunrise timings are calculated. So location is technically used only inside the app.

      Here is how it works:
      • You enable sunset/sunrise timings.
      • App checks for location permission, and asks for it if not present.
      • When location permissions are acquired, it detects your current location using Location APIs, which is in form of co-ordinates (latitude and longitude), and stores them as shared preferences.
      • The sunset and sunrise timings are calculated based on the co-ordinates acquired from previous step.
      • An on alarm is set at sunset timing, and off alarm is set at sunrise timing.
      • Sunset time comes, on alarm fires, turning Night Light on.
      • Sunrise time comes, off alarm fires, turning Night Light off. Additionally, sunset and sunrise times are re-calculated for the new day. The co-ordinates used are the ones stored in shared preferences. This is basically step 4 re-done and so-forth.
      While this should work for most users, I understand the timings could be inaccurate for users who travel a lot. An option to re-detect location every time before calculating sunset/sunrise could be added if necessary.

      Also I remembering us talking about the same over email, but I get lots of emails , and eventually lost track of our conversation, so sorry for that. I hope this clarification is adequate.

      This is a terrific app. Thanks.

      Is it possible to set it up to use min intensity at all time (my display is on the cool side, so I like to reduce blue) and max intensity between x and y hours? I know that's not how it's i to be used, but that's my use case.

      Thanks in advance

      Edit : I set start time to 6am and end time to 5:59. That seems to work.

      It's not starting on boot though. I have to open the app manually. Delay set at 20 secs. Mi a3 android pie with bit caf kernel.

      You can disable "Dark hours", and set the color controls to use minimum intensity. Will need to check the set on boot though.
      4
      v2.0 preview is available in XDA Labs

      If you are interested in testing out the new v2 preview, you can get it from XDA Labs (beta channel)
      Link - https://labs.xda-developers.com/store/app/com.corphish.nightlight.generic
      4
      Night Light 3.0 is here!

      • Automation routines - Brand new way of automating Night Light is here.
        • Setup routines where you can define the Night Light settings that you would want to apply in a specific time period of the day.
        • You can have as many routines as you want. They will be automatically applied in the time period specified.
        • There is only one thumb rule: Time periods of routines cannot overlap, which means you cannot have more than 1 routine for a specific time period.
        • Routines are easy to set up with a step wise interface.
      • Night Light intensity fading in/out.
        • You can have Night Light intensity to fade in/out from intensity to other as part of an automation routine.
        • Set fade poll rate which defines the interval at which faded settings are applied.
      • Removed the maximum and minimum intensities since we now have automation routines.
      • Added an option to automatically disable Night Light in lock screen and automatically turn it back on when the device is unlocked.
      • Redesigned settings section.
      • Updated the interface for creating and listing profiles.
      • Fixed launcher shortcut toggle.
      • Added tutorials in various sections.
      • Other bug fixes.

      It is available in Play Store (RIP XDA Labs). Do let me know if you have any ideas to enhance any functionality. Thank you and happy new year!
      4
      @jineshpatel30 @rickysidhu_

      Here is an experimental version (in the attachment of this reply), with launcher shortcut toggle and set on boot fixed.
      The reason why it is experimental :
      - Now written in kotlin
      - Uses some of the new stuff announced in I/O 18, like ktx and the new material design style
      - Uses different font called 'Acme'. (Feel free to suggest fonts)
      - I decided to ditch cards because normal layouts look better in this new style.

      Source - https://github.com/corphish/NightLight/tree/p