├── .gitignore ├── index.js ├── license ├── nasa-api-key.js ├── package.json ├── readme.md └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const { nasaApiKey } = require('./nasa-api-key'); 4 | 5 | exports.decorateConfig = (config) => { 6 | const { overlayColor = '#000', overlayOpacity = .5 } = config.hypernasa || {}; 7 | 8 | return Object.assign({}, config, { 9 | backgroundColor: 'transparent', 10 | css: ` 11 | ${config.css} 12 | 13 | .hyper_main { 14 | background-color: ${overlayColor}; 15 | background-size: cover; 16 | background-position: center; 17 | } 18 | 19 | .hyper_main:before { 20 | content: ''; 21 | position: absolute; 22 | top: 0; 23 | bottom: 0; 24 | left: 0; 25 | right: 0; 26 | background-color: ${overlayColor}; 27 | opacity: ${overlayOpacity}; 28 | } 29 | 30 | .tab_tab { 31 | background-color: transparent !important; 32 | } 33 | ` 34 | }); 35 | } 36 | 37 | exports.decorateHyper = (Hyper, { React }) => 38 | class extends React.Component { 39 | constructor (props, context) { 40 | super(props, context); 41 | this._fetchImage(); 42 | this._startUpdater(); 43 | } 44 | 45 | _fetchImage () { 46 | fetch(`https://api.nasa.gov/planetary/apod?api_key=${nasaApiKey}`) 47 | .then((response) => response.json()) 48 | .then(({ hdurl, url }) => this.setState({ image: hdurl || url })); 49 | } 50 | 51 | _startUpdater () { 52 | const second = 1000 53 | const minute = 60 * second 54 | const hour = 60 * minute 55 | setInterval(this._fetchImage.bind(this), hour) 56 | } 57 | 58 | render () { 59 | return React.createElement(Hyper, Object.assign({}, this.props, { 60 | customCSS: ` 61 | ${this.props.customCSS} 62 | 63 | .hyper_main { 64 | background-image: url("${this.state && this.state.image}"); 65 | } 66 | ` 67 | })); 68 | } 69 | }; 70 | -------------------------------------------------------------------------------- /license: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Colm Seale 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /nasa-api-key.js: -------------------------------------------------------------------------------- 1 | exports.nasaApiKey= '3ijdtiQuzkcp5CbCkRKzwcNDZD7qLQpEbvdq49Ra' 2 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hypernasa", 3 | "version": "1.3.0", 4 | "description": "nasa picture of the day background image for hyper", 5 | "main": "index.js", 6 | "files": [ 7 | "index.js", 8 | "nasa-api-key.js" 9 | ], 10 | "scripts": { 11 | "test": "echo \"Error: no test specified\" && exit 1" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "git+https://github.com/cseale/hypernasa.git" 16 | }, 17 | "keywords": [ 18 | "nasa", 19 | "hyper", 20 | "hypernasa" 21 | ], 22 | "author": "Colm Seale", 23 | "contributors": [{ 24 | "name": "Casey Webb", 25 | "url": "https://github.com/caseyWebb" 26 | }, { 27 | "name": "Jack Tuck", 28 | "url": "https://github.com/jacktuck" 29 | }, { 30 | "name": "Dima Paloskin", 31 | "url": "https://github.com/dimapaloskin" 32 | }], 33 | "license": "MIT", 34 | "bugs": { 35 | "url": "https://github.com/cseale/hypernasa/issues" 36 | }, 37 | "homepage": "https://github.com/cseale/hypernasa#readme" 38 | } 39 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # hypernasa 2 | 3 | > Nasa [Hyper](https://hyper.is) extension 4 | 5 | A theme which replaces the terminal background with NASA's Picture of the Day. (https://apod.nasa.gov/apod/archivepix.html). 6 | 7 | ![](screenshot.png) 8 | 9 | 10 | ## Install 11 | 12 | Add `hypernasa` to the plugins list in your `~/.hyper.js` config file. 13 | 14 | ## Options 15 | 16 | *~/.hyper.js* 17 | ```javascript 18 | module.exports = { 19 | config: { 20 | hypernasa: { 21 | overlayColor: #000, 22 | overlayOpacity: .25 23 | } 24 | } 25 | } 26 | ``` 27 | 28 | ## License 29 | 30 | MIT © [Colm Seale] 31 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cseale/hypernasa/9beced172edd6f37016a9a6a5988bc54162e9891/screenshot.png --------------------------------------------------------------------------------