Skip to content

Commit

Permalink
Merge pull request #1 from projekt0n/dev
Browse files Browse the repository at this point in the history
Init
  • Loading branch information
ful1e5 authored Jul 9, 2021
2 parents 9e98f44 + 2923ee3 commit ac82651
Show file tree
Hide file tree
Showing 25 changed files with 1,991 additions and 2 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Linting

on:
push:
branches: [main, dev]
pull_request:
paths-ignore:
- "**.md"
- LICENSE
branches: [main]

jobs:
build:
name: Luacheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install linter
run: |
sudo apt-get update
sudo apt-get install luarocks
sudo luarocks install luacheck
- name: Lint
run: make lint
4 changes: 4 additions & 0 deletions .lua-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
column_limit: 90
indent_width: 2
single_quote_to_double_quote: true
keep_simple_function_one_line: false
2 changes: 2 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
globals = {"vim"}
max_comment_line_length = false
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [unreleased]

### Added

- Initial release 🎊

<!-- [unreleased]: https://github.com/projekt0n/github-nvim-theme/compare/v0.0.1...main -->
<!-- [v0.0.1]: https://github.com/projekt0n/github-nvim-theme/tree/v0.0.1 -->

[unreleased]: https://github.com/projekt0n/github-nvim-theme/tree/main
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.DEFAULT_GOAL = check

github_path = lua/github-theme
extra_path = $(github_path)/extra

extra: $(extra_path)
@lua $(extra_path)/init.lua

format:
@for file in `find . -name '*.lua'`;do lua-format $$file -i; done;

lint: $(github_path)
@luacheck $(github_path)

check: format lint


# reload kitty theme
# https://github.com/ful1e5/dotfiles
theme = ~/.config/kitty/themes/github.conf
exts = ./extras/

kitty_pre:
@rm -rf $(theme)
@touch $(theme)

kitty_dark: kitty_pre
@cat $(exts)/kitty_github_dark.conf > $(theme)

kitty_dimmed: kitty_pre
@cat $(exts)/kitty_github_dimmed.conf > $(theme)

kitty_light: kitty_pre
@cat $(exts)/kitty_github_light.conf > $(theme)
273 changes: 271 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,271 @@
# github-nvim-theme
Github's theme for Neovim, written in Lua
<p align="center">
<img src="https://imgur.com/jP33Wgo.png" alt="github-nvim-theme" />
</p>

### Status

[![Linting](https://github.com/projekt0n/github-nvim-theme/actions/workflows/lint.yml/badge.svg)](https://github.com/projekt0n/github-nvim-theme/actions/workflows/lint.yml)
[![Twitter](https://img.shields.io/badge/twitter-projekt0n-blue)](https://twitter.com/projekt0n)

## Features

- supports the latest Neovim 0.5 features like TreeSitter and LSP
- minimal inactive statusline
- vim terminal colors
- darker background for sidebar-like windows
- color configs for [Kitty](https://sw.kovidgoyal.net/kitty/conf.html?highlight=include) and [Alacritty](https://github.com/alacritty/alacritty)
- dynamic **lualine** theme

### Plugin Support

- [TreeSitter](https://github.com/nvim-treesitter/nvim-treesitter)
- [LSP Diagnostics](https://neovim.io/doc/user/lsp.html)
- [LSP Trouble](https://github.com/folke/lsp-trouble.nvim)
- [Git Signs](https://github.com/lewis6991/gitsigns.nvim)
- [Telescope](https://github.com/nvim-telescope/telescope.nvim)
- [NvimTree](https://github.com/kyazdani42/nvim-tree.lua)
- [Lualine](https://github.com/hoob3rt/lualine.nvim)

## Requirements

- Neovim >= 0.5.0

## Installation

Install the theme with your preferred package manager:

[vim-plug](https://github.com/junegunn/vim-plug)

```vim
Plug 'projekt0n/github-nvim-theme'
```

[packer](https://github.com/wbthomason/packer.nvim)

```lua
use 'projekt0n/github-nvim-theme'
```

## Usage

Enable the colorscheme:

```vim
" Vim Script
lua require('github-theme').setup()
```

```lua
-- Lua
require('github-theme').setup()
```

To enable the `github` theme for `Lualine`, simply specify it in your lualine settings:

> Set `lualine` configuration **before** `github-theme`.
```lua
require('lualine').setup {
options = {
theme = 'github',
-- For round icons (require Nerd-Font)
-- section_separators = {"", ""},
-- component_separators = {"", ""},
-- ... your lualine config
}
}
```

## Configuration

| Option | Default | Description |
| ---------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| themeStyle | `dark` | Set theme variant (options: `dark`/`dimmed`/`light`) |
| commentStyle | `italic` | Highlight style for comments (check `:help highlight-args` for options) |
| keywordStyle | `italic` | Highlight style for keywords (check `:help highlight-args` for options) |
| functionStyle | `NONE` | Highlight style for functions (check `:help highlight-args` for options) |
| variableStyle | `NONE` | Highlight style for variables and identifiers (check `:help highlight-args` for options) |
| transparent | `false` | Enable this to disable setting the background color |
| hideInactiveStatusline | `false` | Enabling this option, will hide inactive statuslines and replace them with a thin border instead. Should work with the standard **StatusLine** and **LuaLine**. |
| sidebars | `{}` | Set a darker background on sidebar-like windows. For example: `{"qf", "vista_kind", "terminal", "packer"}` |
| darkSidebar | `true` | Sidebar like windows like `NvimTree` get a darker background |
| darkFloat | `true` | Float windows like the lsp diagnostics windows get a darker background. |
| colors | `{}` | You can override specific color groups to use other groups or a hex color |

```lua
-- Example config in Lua
require("github-theme").setup({
functionStyle = "italic",
sidebars = {"qf", "vista_kind", "terminal", "packer"},

-- Change the "hint" color to the "orange" color, and make the "error" color bright red
colors = {hint = "orange", error = "#ff0000"}
})
```

```vim
" Example config in VimScript
lua << EOF
require("github-theme").setup({
functionStyle = "italic",
sidebars = {"qf", "vista_kind", "terminal", "packer"},
-- Change the "hint" color to the "orange" color, and make the "error" color bright red
colors = {hint = "orange", error = "#ff0000"}
})
EOF
```

### Making `undercurls` work properly in **Tmux**

To have undercurls show up and in color, add the following to your **Tmux** config file:

```sh
# Undercurl
set -g default-terminal "${TERM}"
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
```

## Extras

> To generate the configs `make extra` or `:luafile lua/github-theme/extra/init.lua`
Extra color configs for **Kitty**, and **Alacritty** can be found in [extras](extras/). To use them, refer to their respective documentation.

## Reference

- [monsonjeremy/onedark.nvim](https://github.com/monsonjeremy/onedark.nvim)
- [primer/github-vscode-theme](https://github.com/primer/github-vscode-theme)

## 📺 Screenshot

### Dark

```lua
require("github-theme").setup({
themeStyle = "dark",
-- ... your github-theme config
})
```

<p align="center">
<img src="https://imgur.com/W5KOVl9.png" alt="github-dark-theme" />
</p>

### Dimmed

```lua
require("github-theme").setup({
themeStyle = "dimmed",
-- ... your github-theme config
})
```

<p align="center">
<img src="https://imgur.com/4vyzl9p.png" alt="github-dimmed-theme" />
</p>

### Light

```lua
require("github-theme").setup({
themeStyle = "light",
-- ... your github-theme config
})
```

<p align="center">
<img src="https://imgur.com/WoHO2KJ.png" alt="github-light-theme" />
</p>

### Default

<p align="center">
<img src="https://imgur.com/yk9rD0p.png" alt="Default fonts" />
</p>

### Normal

```lua
require("github-theme").setup({
commentStyle = "NONE",
keywordStyle = "NONE",
functionStyle = "NONE",
variableStyle = "NONE"
-- ... your github-theme config
})
```

<p align="center">
<img src="https://imgur.com/wM8GZJX.png" alt="Normal fonts" />
</p>

### Italic

```lua
require("github-theme").setup({
commentStyle = "italic",
keywordStyle = "italic",
functionStyle = "italic",
variableStyle = "italic"
-- ... your github-theme config
})
```

<p align="center">
<img src="https://imgur.com/B93ytVb.png" alt="Italic fonts" />
</p>

### Minimal

```lua
require("github-theme").setup({
hideInactiveStatusline = true,
darkSidebar = false,
darkFloat = true
-- ... your github-theme config
})
```

<p align="center">
<img src="https://imgur.com/rHOoyJP.png" alt="Minimal" />
</p>

### Telescope

<p align="center">
<img src="https://imgur.com/TjoW19w.png" alt="Telescope plugin" />
</p>

## Useful Links

- Terminal: [Kitty](https://sw.kovidgoyal.net/kitty)
- Font: [Ubuntu Mono](https://design.ubuntu.com/font/)
- config: [dotfiles](https://github.com/ful1e5/dotfiles)

## Support The Creator

<a href="https://www.buymeacoffee.com/Nt7Wg4V" >
<img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" >
</a>

#### TODO:

- [x] Init
- [x] Dynamic theme for `lualine`
- [ ] Ask for using github-vscode-theme branding logo (primer/github-vscode-theme#186)
- [x] Support highlight for almost every language.
- [x] Previews & Customization docs inside README.md
- [x] Better color grouping inside [colors.lua](./lua/github-theme/colors.lua)
- [ ] Dynamic colors using [Primer color Palette](https://primer.style/primitives/)
- [ ] Follow [Primer color system](https://primer.style/css/support/color-system)
- [ ] Rewrite github-vscode-theme util functions inside lua
- [ ] Add Github Light Classic & Github Dark Classic styles
- [ ] Change NvimTreeIcon & DevIcons colors
- [ ] Write tests

<!-- Ninja -->
<p align="center">
<h1 align="center">(◣_◢)</h1>
</p>
7 changes: 7 additions & 0 deletions colors/github.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
" clear cache so this reloads changes.
" useful for development
lua package.loaded['github-theme'] = nil
lua package.loaded['github-theme.theme'] = nil
lua package.loaded['github-theme.colors'] = nil
lua package.loaded['github-theme.util'] = nil
lua package.loaded['github-theme.config'] = nil
Loading

0 comments on commit ac82651

Please sign in to comment.