philippus / emoji-clock   0.3.1

MIT License GitHub

πŸ•Ÿ Generate the emoji clock face, moon phase πŸŒ— , or zodiac sign ♉ 🐢 for a given time

Scala versions: 2.13 2.12 2.11

Emoji-clock

build codecov Current Version License

Emoji-clock can, when given a date-time, generate the applicable emoji short code for:

  • clock faces
  • lunar phases
  • (tropical) zodiac signs
  • chinese zodiac signs

To view the emoji itself you will need an emoji library such as Lightbend Emoji.

Installation

Emoji-clock is published for Scala 2.12 and 2.13. To start using it add the following to your build.sbt:

libraryDependencies += "nl.gn0s1s" %% "emoji-clock" % "0.3.1"

Example usage

Follow the Lightbend Emoji installation instructions also for these examples:

import nl.gn0s1s.emojiclock.EmojiClock
import com.lightbend.emoji.ShortCodes.Defaults._
import com.lightbend.emoji.ShortCodes.Implicits._

EmojiClock.clockFaceShortCode(java.time.LocalDateTime.of(2018, 1, 31, 1, 50))
// res0: String = clock2
EmojiClock.clockFaceShortCode(java.time.LocalDateTime.of(2018, 1, 31, 1, 50)).emoji
// res1: com.lightbend.emoji.Emoji = πŸ•‘

EmojiClock.now() // at 16:44
// res2: String = clock430
EmojiClock.now().emoji
// res3: com.lightbend.emoji.Emoji = πŸ•Ÿ
import nl.gn0s1s.emojiclock.EmojiLunarPhase
import com.lightbend.emoji.ShortCodes.Defaults._
import com.lightbend.emoji.ShortCodes.Implicits._

EmojiLunarPhase.lunarPhaseShortCode(java.time.LocalDateTime.of(2018, 1, 31, 0, 0))
// res0: String = full_moon
EmojiLunarPhase.lunarPhaseShortCode(java.time.LocalDateTime.of(2017, 12, 10, 0, 0)).emoji
// res1: com.lightbend.emoji.Emoji = πŸŒ—

EmojiLunarPhase.now() // at 1st December 2017
// res2: String = full_moon
EmojiLunarPhase.now().emoji
// res3: com.lightbend.emoji.Emoji = πŸŒ•
import nl.gn0s1s.emojiclock.EmojiZodiacSign
import com.lightbend.emoji.ShortCodes.Defaults._
import com.lightbend.emoji.ShortCodes.Implicits._

EmojiZodiacSign.zodiacSignShortCode(java.time.LocalDateTime.of(2018, 1, 31, 0, 0))
// res0: String = aquarius
EmojiZodiacSign.zodiacSignShortCode(java.time.LocalDateTime.of(2017, 5, 5, 0, 0)).emoji
// res1: com.lightbend.emoji.Emoji = ♉

EmojiZodiacSign.now() // at 2nd December 2017
// res2: String = sagittarius
EmojiZodiacSign.now().emoji
// res3: com.lightbend.emoji.Emoji = ♐
import nl.gn0s1s.emojiclock.EmojiChineseZodiac
import com.lightbend.emoji.ShortCodes.Defaults._
import com.lightbend.emoji.ShortCodes.Implicits._

EmojiChineseZodiac.chineseZodiacSignShortCode(java.time.LocalDateTime.of(2018, 1, 31, 0, 0))
// res0: String = rooster
EmojiChineseZodiac.chineseZodiacSignShortCode(java.time.LocalDateTime.of(2015, 5, 5, 0, 0)).emoji
// res1: com.lightbend.emoji.Emoji = 🐐

EmojiChineseZodiac.now() // at 1st January 2019
// res2: String = dog
EmojiChineseZodiac.now().emoji
// res3: com.lightbend.emoji.Emoji = 🐢

sbt-prompt

in examples/sbt-prompt you can see how you could add an emoji clock to your sbt-prompt.

Links

License

The code is available under the MIT license.