skylight

An interface for determining sunrise, sunset, and related info for a given location.

License

License

GroupId

GroupId

dev.drewhamilton.skylight
ArtifactId

ArtifactId

skylight
Last Version

Last Version

0.12.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

skylight
An interface for determining sunrise, sunset, and related info for a given location.
Project URL

Project URL

https://github.com/drewhamilton/Skylight
Source Code Management

Source Code Management

https://github.com/drewhamilton/Skylight

Download skylight

Dependencies

compile (1)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib jar 1.4.10

runtime (1)

Group / Artifact Type Version
dev.drewhamilton.extracare : data-api-annotations jar 0.3.0

Project Modules

There are no modules declared in this project.

Skylight

Skylight is a Kotlin/JVM interface for determining sunrise, sunset, and similar details for a given location and date.

Download

Maven Central

Skylight is available on Maven Central. To use Skylight, include any of the following in your Gradle dependencies:

// The base interface:
implementation "dev.drewhamilton.skylight:skylight:$version"

// sunrise-sunset.org implementation:
implementation "dev.drewhamilton.skylight:skylight-sunrise-sunset-org:$version"
// Calculator implementation:
implementation "dev.drewhamilton.skylight:skylight-calculator:$version"
// Fake implementation:
implementation "dev.drewhamilton.skylight:skylight-fake:$version"

Usage

Skylight is still in pre-release development, and the API may undergo breaking changes before version 1.0.0.

Determine dawn, sunrise, sunset, and dusk for a given location and date, and process it simply and intuitively.

val amsterdam = Coordinates(52.3680, 4.9036)
val tomorrow = LocalDate.now().plusDays(1)
val skylight: Skylight = CalculatorSkylight()

val skylightDay = skylight.getSkylightDay(amsterdam, tomorrow)
val message = when {
    skylightDay is SkylightDay.AlwaysDaytime ->
        "The sun will be up all day in Amsterdam tomorrow."
    skylightDay is SkylightDay.Typical && skylightDay.sunrise != null ->
        "The sun will rise in Amsterdam tomorrow."
    else ->
        "The sun will not rise in Amsterdam tomorrow."
}
display(message)

Skylight requires Java 8.

Using Skylight on Android requires enabling core library desugaring, available with Android Gradle Plugin version 4.0.0 and higher. If you are using Skylight on Android, also see Skylight Android for a few added features.

License

Copyright 2018 Drew Hamilton

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Versions

Version
0.12.0