How to use the bitbar.darkMode function in bitbar

To help you get started, we’ve selected a few bitbar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github robertbenjamin / bit-bus / index.js View on Github external
// v1.0
// Robert Benjamin
// robertbenjamin
// A BitBar menubar app for seeing when the next bus arrives at my work.
// http://i.imgur.com/zjuQRQF.png
// node,superagent,momentjs
// https://github.com/robertbenjamin/bit-bus

const bitbar = require('bitbar');
const request = require('superagent');
const moment = require('moment');
const busAPIKey = require('./src/API_KEY.js') || 'TEST';

let busStop = 18620;
let busAPI = `http://api.pugetsound.onebusaway.org/api/where/arrivals-and-departures-for-stop/1_${busStop}.json?key=${busAPIKey}&minutesAfter=70`;
let menuColor = bitbar.darkMode ? 'white' : 'black';
let warningColor = '#ff4136';

request
.get(busAPI)
.end((err, res) => {
  if (err || !res.ok) bitbar([{ text: ':bus: no internet :(', color: warningColor }]);

  let response = JSON.parse(res.text);
  let trips = response.data.entry.arrivalsAndDepartures;

  if (trips.length === 0) {
    bitbar([{ text: ':bus: no more trips', color: warningColor }]);
  } else {
    let myTrips = trips
      .filter(trip => trip.routeShortName === '32')
      .map(trip => {

bitbar

Simplifies BitBar app plugin creation

MIT
Latest version published 3 years ago

Package Health Score

51 / 100
Full package analysis

Popular bitbar functions