chore: Merge develop

This commit is contained in:
Mattia Astorino 2018-06-28 23:41:25 +02:00
commit 0e5a91426e
No known key found for this signature in database
GPG key ID: 7BE552533AB6D4E2
157 changed files with 324 additions and 2390 deletions

1
.gitignore vendored
View file

@ -11,3 +11,4 @@ node_modules/
/icons
/src/icons/svgs/*.svg
.tmp-output-remote-icons
_tmp-output-remote-icons

View file

@ -2,6 +2,35 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
<a name="2.2.0"></a>
# [2.2.0](https://github.com/equinusocio/vsc-material-theme/compare/v2.0.1...v2.2.0) (2018-06-28)
### Bug Fixes
* Fix rust file icon association ([c4e1dbe](https://github.com/equinusocio/vsc-material-theme/commit/c4e1dbe))
* Fix some icon colors and add haxe file icon ([04e7db8](https://github.com/equinusocio/vsc-material-theme/commit/04e7db8))
* **Icons:** Add icon to .spec.ts files ([fad5e29](https://github.com/equinusocio/vsc-material-theme/commit/fad5e29))
* **Lighter:** Fix folders icon association ([b2c8be8](https://github.com/equinusocio/vsc-material-theme/commit/b2c8be8))
* Fix statubar item hover background ([c19ab43](https://github.com/equinusocio/vsc-material-theme/commit/c19ab43))
* Fix status bar hover item background on Lighter variant. ([27624fa](https://github.com/equinusocio/vsc-material-theme/commit/27624fa))
* Fix terminal.ansiBlack color ([86def00](https://github.com/equinusocio/vsc-material-theme/commit/86def00)), closes [#180](https://github.com/equinusocio/vsc-material-theme/issues/180)
* Fix titlebar contrast color ([74e0456](https://github.com/equinusocio/vsc-material-theme/commit/74e0456))
* Fix ts icon color ([4c851ea](https://github.com/equinusocio/vsc-material-theme/commit/4c851ea)), closes [#172](https://github.com/equinusocio/vsc-material-theme/issues/172)
* Improve panels titles ([905e99a](https://github.com/equinusocio/vsc-material-theme/commit/905e99a)), closes [#208](https://github.com/equinusocio/vsc-material-theme/issues/208)
### Features
* Add .lnk file icon ([8aaabe8](https://github.com/equinusocio/vsc-material-theme/commit/8aaabe8)), closes [#201](https://github.com/equinusocio/vsc-material-theme/issues/201)
* Add mdx file icon ([d191329](https://github.com/equinusocio/vsc-material-theme/commit/d191329)), closes [#211](https://github.com/equinusocio/vsc-material-theme/issues/211)
* Add support to the new settings view ([1e6150b](https://github.com/equinusocio/vsc-material-theme/commit/1e6150b))
* New command to enabling/disabling icons auto-applaying ([0fa2ac0](https://github.com/equinusocio/vsc-material-theme/commit/0fa2ac0))
* New redesigned icons for folders and add new scs and css folder icon ([a293a6f](https://github.com/equinusocio/vsc-material-theme/commit/a293a6f))
* New set of file icons with new and redesigned icons ([eb1c2ed](https://github.com/equinusocio/vsc-material-theme/commit/eb1c2ed))
<a name="2.1.0"></a>
# [2.1.0](https://github.com/equinusocio/vsc-material-theme/compare/v2.0.1...v2.1.0) (2018-05-24)

View file

@ -4,13 +4,12 @@
## Requirements:
* Nodejs ^6.x
* Nodejs ^8.x
* Visual Studio Code
* GPG Tool
- [Contributing guidelines](#contributing-guidelines)
- [Requirements:](#requirements)
- [Decrypt content](#decrypt-content)
- [Installing and compiling source](#installing-and-compiling-source)
- [Testing the theme](#testing-the-theme)
- [Adding new Material Theme commands](#adding-new-material-theme-commands)
@ -21,16 +20,6 @@
- [Backers](#backers)
- [Sponsors](#sponsors)
## Decrypt content
We use git-crypt to encrypt compiler files. To contribute you need a GPG key public/private associated with your github email.
1. Export your public key by running
```gpg --output PATH/FILENAME.gpg --export ASSOCIATEDEMAIL```
2. Send the exported `.gpg` file to a contributor that will add you to the trusted people.
3. Fetch and pull then decrypt files with `git-crypt unlock` entering your key password.
## Installing and compiling source
First you will have to install node_modules through npm or yarn
@ -43,7 +32,7 @@ yarn install
To compile to the source code, you have to execute the build task through visual studio code.
First you need to invoke to quick command (on MacOS `⌘P`, while on Linux/windows is `ctrl+p`)
then type `task build` and wait until vsc will have finished the task.
then type `task build` and wait until VSC will have finished the task.
### Testing the theme
@ -51,6 +40,82 @@ To test the theme, you will have to go to the debug section, select the *Launch
### Adding new Material Theme commands
Material Theme commands are located inside the `extensions/commands` directory. They are split by folders so you can find a single specific `index.ts` file inside a `command` folder. This is a patter choice: so you can add related command helpers inside that folder.
#### index.ts
The main file must return a `function`. The `function` can be `async` or `sync`.
We want to make this clear, so the `async` declaration must be present even if you want to use `then()` for chaining inside the `function`.
##### Example of `async` exported `function`
```js
export default async (): Promise<boolean> => {
...
```
##### Example of `sync` exported `function`
```js
export default (): boolean => {
...
```
#### Using external "mini" modules
We encourage you to split up your command in other small modules so they can be **tested** more easily and outside of the context.
#### Register the command
You must register the new command to execute it when it's called by the user.
Firstly add the command to our commands `extensions/commands/index.ts`
```js
export {default as awesomeCommand} from './awesome-command';
```
Commands are registered within the `extensions/material.theme.config.ts` file.
Just add a new registration after the others that will run your command:
```js
Commands.registerCommand('materialTheme.awesomeCommand', () => ThemeCommands.awesomeCommand());
```
#### Add to package.json
When you are ready to test your new command you must add its declaration within the `package.json`. The command **must be prefixed with** `materialTheme.` prefix.
As the others your command will look like this:
Level: `contribute.commands -> Array`
```json
{
"command": "materialTheme.awesomeCommand",
"title": "Awesome Title For Command",
"category": "🎨 Material Theme"
}
```
#### Build and run
Now you can re-build the theme and just run the debug, you will see your command in the command list of VSCode just searching for its title.
#### Test your command
A test suite is currently in developing. Update soon.
### Adding new custom setting
Soon(ish)®
### Adding new icons
@ -59,10 +124,12 @@ Soon(ish)®
* Add the reference to that icon to the `~/src/icons/partials/fileNames.js` or if your icon is referred to a directory adds the reference to the `~/src/icons/partials/folderNames.js` file, otherwise to `~/src/icons/partials/fileExtensions.js` if is referred to a file extension.
* If you want to make the icon sensitive to be accented, modify the `~/extensions/defaults.json` file, adding the icon definition to the `accentableIcons` array (e.g. ["_folder_open", "_folder_open_build"]) and the path to the `icons.theme.iconDefinitions` object. The same applies to variants (the variant icons array is called "variantsIcons")
* If you want to make the icon sensitive to be accented, modify the `~/extensions/defaults.json` file, adding the icon definition to the `accentableIcons` array (e.g. ["_folder_open", "_folder_open_build"]) and the path to the `icons.theme.iconDefinitions` object. **The same applies to variants (the variant icons array is called "variantsIcons")**
* Execute the build command.
* Start the debug
* Enjoy your new icons in Material Theme, and don't forget to pull request!

View file

@ -4,14 +4,11 @@
[![Twitter](https://img.shields.io/twitter/url/https/github.com/equinusocio/vsc-material-theme.svg?style=flat-square)](https://twitter.com/intent/tweet?text=This%20is%20the%20most%20epic%20theme:&url=https%3A%2F%2Fgithub.com%2Fequinusocio%2Fvsc-material-theme)
[![GitHub tag](https://img.shields.io/github/release/equinusocio/vsc-material-theme.svg?style=flat-square)](https://github.com/equinusocio/vsc-material-theme/releases)
<a href="https://code.visualstudio.com/updates/v1_19"><img src="https://img.shields.io/badge/VS_Code-v1.19+-373277.svg?style=flat-square"/></a> <a href="https://marketplace.visualstudio.com/items?itemName=Equinusocio.vsc-material-theme"><img src="https://vsmarketplacebadge.apphb.com/installs/Equinusocio.vsc-material-theme.svg?style=flat-square"/></a>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=9RSHP5RSLKH64&lc=GB&item_name=Material%20Theme%20for%20Visual%20Studio%20Code&item_number=material%2dtheme%2ddonation&no_note=0&cn=Aggiungi%20istruzioni%20speciali%20per%20il%20venditore%3a&no_shipping=2&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted
"><img src="https://img.shields.io/badge/Support%20this%20project-%F0%9F%92%80-ff69b4.svg?style=flat-square"/></a>
<a href="https://opencollective.com/vsc-material-theme"><img src="https://img.shields.io/badge/Support%20this%20project-%F0%9F%92%96%EF%B8%8F-green.svg?style=flat-square"/></a>
The most epic theme meets Visual Studio Code. You can help by reporting issues [here](https://github.com/equinusocio/vsc-material-theme/issues)
<!-- TOC -->
- [Getting started](#getting-started)
- [Installation](#installation)
- [Packaged VSIX Extension](#packaged-vsix-extension)
@ -19,10 +16,9 @@ The most epic theme meets Visual Studio Code. You can help by reporting issues [
- [Activate theme](#activate-theme)
- [Fix File Icons](#fix-file-icons)
- [Set the accent color](#set-the-accent-color)
- [Disabling/enabling file icons auto-applying](#disabling-enabling-file-icons-auto-applying)
- [Disabling/enabling file icons auto-applying](#disablingenabling-file-icons-auto-applying)
- [Override theme colors](#override-theme-colors)
- [Color Scheme override](#color-scheme-override)
- [UI Overrides](#ui-overrides)
- [Recommended settings for a better experience](#recommended-settings-for-a-better-experience)
- [Official Portings](#official-portings)
- [Other resources](#other-resources)
@ -30,7 +26,6 @@ The most epic theme meets Visual Studio Code. You can help by reporting issues [
- [Backers](#backers)
- [Sponsors](#sponsors)
<!-- /TOC -->
# Getting started
@ -138,6 +133,7 @@ You can override the material theme ui and schemes colors by adding these theme-
```js
"editor.tokenColorCustomizations": {
"[Material Theme VARIANT]": {
"sideBar.background": "#347890",
"textMateRules": [
{
"scope": [
@ -155,16 +151,6 @@ You can override the material theme ui and schemes colors by adding these theme-
},
```
### UI Overrides
```js
"workbench.colorCustomizations": {
"[Material Theme]": {
"sideBar.background": "#347890"
},
}
```
# Recommended settings for a better experience
```js

View file

@ -1,77 +1,19 @@
import * as vscode from 'vscode';
import {IAccentCustomProperty} from './../../interfaces/iaccent-custom-property';
import {IGenericObject} from './../../interfaces/igeneric-object';
import {
updateAccent,
} from './../../helpers/settings';
import {getDefaultValues} from './../../helpers/fs';
import {updateAccent} from './../../helpers/settings';
import {getDefaultValues, getAccentsProperties} from './../../helpers/fs';
const REGEXP_HEX: RegExp = /^#([0-9A-F]{6}|[0-9A-F]{8})$/i;
const accentsProperties: IGenericObject <IAccentCustomProperty> = {
'activityBarBadge.background': {
alpha: 100,
value: undefined
},
'list.activeSelectionForeground': {
alpha: 100,
value: undefined
},
'list.inactiveSelectionForeground': {
alpha: 100,
value: undefined
},
'list.highlightForeground': {
alpha: 100,
value: undefined
},
'scrollbarSlider.activeBackground': {
alpha: 50,
value: undefined
},
'editorSuggestWidget.highlightForeground': {
alpha: 100,
value: undefined
},
'textLink.foreground': {
alpha: 100,
value: undefined
},
'progressBar.background': {
alpha: 100,
value: undefined
},
'pickerGroup.foreground': {
alpha: 100,
value: undefined
},
'tab.activeBorder': {
alpha: 100,
value: undefined
},
'notificationLink.foreground': {
alpha: 100,
value: undefined
},
'editor.findWidgetResizeBorder': {
alpha: 100,
value: undefined
},
'editorWidget.border': {
alpha: 100,
value: undefined
}
};
/**
* Assigns colours
*/
const assignColorCustomizations = (colour: string, config: any): void => {
const accentsProperties = getAccentsProperties();
const newColour = isValidColour(colour) ? colour : undefined;
Object.keys(accentsProperties).forEach(propertyName => {
const accent: IAccentCustomProperty = accentsProperties[propertyName];
const accent = accentsProperties[propertyName];
let colorProp = newColour;
if (colour && accent.alpha < 100) {
@ -110,7 +52,7 @@ export default async (): Promise<boolean> => {
const accentSelected = await vscode.window.showQuickPick(options);
if (accentSelected === null || accentSelected === undefined) {
Promise.resolve(null);
return Promise.resolve(null);
}
const config: any = vscode.workspace.getConfiguration().get('workbench.colorCustomizations');

View file

@ -25,6 +25,8 @@
"_folder_node_open",
"_folder_images_open",
"_folder_js_open",
"_folder_css_open",
"_folder_sass_open",
"_folder_src_open",
"_folder_assets_open",
"_folder_bower_open",
@ -34,12 +36,86 @@
"_folder_dist_open",
"_folder_ci_open"
],
"accentsProperties": {
"activityBarBadge.background": {
"alpha": 100,
"value": null
},
"list.activeSelectionForeground": {
"alpha": 100,
"value": null
},
"list.inactiveSelectionForeground": {
"alpha": 100,
"value": null
},
"list.highlightForeground": {
"alpha": 100,
"value": null
},
"scrollbarSlider.activeBackground": {
"alpha": 50,
"value": null
},
"editorSuggestWidget.highlightForeground": {
"alpha": 100,
"value": null
},
"textLink.foreground": {
"alpha": 100,
"value": null
},
"progressBar.background": {
"alpha": 100,
"value": null
},
"pickerGroup.foreground": {
"alpha": 100,
"value": null
},
"tab.activeBorder": {
"alpha": 100,
"value": null
},
"notificationLink.foreground": {
"alpha": 100,
"value": null
},
"editor.findWidgetResizeBorder": {
"alpha": 100,
"value": null
},
"editorWidget.border": {
"alpha": 100,
"value": null
},
"settings.modifiedItemForeground": {
"alpha": 100,
"value": null
},
"panelTitle.activeBorder": {
"alpha": 100,
"value": null
}
},
"changelog": {
"lastversion": "2.1.0"
},
"icons": {
"theme": {
"iconDefinitions": {
"_folder_sass": {
"iconPath": "../icons/folder_sass.svg"
},
"_folder_sass_open": {
"iconPath": "../icons/folder_sass_open.svg"
},
"_folder_css": {
"iconPath": "../icons/folder_css.svg"
},
"_folder_css_open": {
"iconPath": "../icons/folder_css_open.svg"
},
"_folder_ci": {
"iconPath": "../icons/folder_ci.svg"
},
@ -121,15 +197,9 @@
"_folder_dark": {
"iconPath": "../icons/folder_dark.svg"
},
"_folder_dark_build": {
"iconPath": "../icons/folder_dark_build.svg"
},
"_folder_light": {
"iconPath": "../icons/folder_light.svg"
},
"_folder_light_build": {
"iconPath": "../icons/folder_light_build.svg"
},
"_file_folder": {
"iconPath": "../icons/file_folder.svg"
},
@ -188,22 +258,22 @@
"Ocean High Contrast": "vs-dark"
},
"variantsIcons": [
"_folder_dark_build",
"_folder_dark",
"_folder_light_build",
"_folder_light",
"_folder_vscode",
"_folder_sass",
"_folder_css",
"_folder_ci",
"_folder_dist",
"_folder_test",
"_folder_github",
"_folder_git",
"_folder_bower",
"_folder_assets",
"_folder_src",
"_folder_js",
"_folder_images",
"_folder_gulp",
"_folder_node",
"_folder_images",
"_folder_js",
"_folder_src",
"_folder_assets",
"_folder_bower",
"_folder_git",
"_folder_github",
"_folder_test",
"_folder_dist",
"_folder_ci"
"_folder_vscode",
"_folder_dark",
"_folder_light"
]
}

View file

@ -36,6 +36,10 @@ export function getVariantIcons(): string[] {
return getDefaultValues().variantsIcons;
}
export function getAccentsProperties() {
return getDefaultValues().accentsProperties;
}
/**
* Gets a theme content by a given contribute ID
*/

View file

@ -4,11 +4,22 @@ import {
import * as ThemeCommands from './../commands';
const INFO_MESSAGE = 'You should reload the window for full activate the Material Theme.';
const OPTIONS = {ok: 'Reload now', cancel: 'Cancel'};
const MESSAGES = {
INFO: {
message: 'You should reload the window for full activate the Material Theme.',
options: {ok: 'Reload now', cancel: 'Cancel'}
},
CHANGELOG: {
message: 'Material Theme was updated. Check the changelog for more details!',
options: {ok: 'Show changelog', cancel: 'Maybe later'}
}
};
export const infoMessage = async () => {
if (await Window.showInformationMessage(INFO_MESSAGE, OPTIONS.ok, OPTIONS.cancel) === OPTIONS.ok) {
if (await Window.showInformationMessage(MESSAGES.INFO.message, MESSAGES.INFO.options.ok, MESSAGES.INFO.options.cancel) === MESSAGES.INFO.options.ok) {
ThemeCommands.fixIcons();
}
};
export const changelogMessage = async () =>
await Window.showInformationMessage(MESSAGES.CHANGELOG.message, MESSAGES.CHANGELOG.options.ok, MESSAGES.CHANGELOG.options.cancel) === MESSAGES.CHANGELOG.options.ok;

View file

@ -1,5 +1,9 @@
import {IGenericObject} from './igeneric-object';
import {IAccentCustomProperty} from './iaccent-custom-property';
export interface IDefaults {
accents: IAccents;
accentsProperties: IGenericObject <IAccentCustomProperty>;
accentableIcons: string[];
changelog: IChangelog;
icons: IDefaultsThemeIcons;

View file

@ -6,10 +6,10 @@ import {
import * as ThemeCommands from './commands';
import {isAutoApplyEnable} from './helpers/settings';
import {onChangeConfiguration} from './helpers/configuration-change';
import {infoMessage} from './helpers/messages';
import {infoMessage, changelogMessage} from './helpers/messages';
import shouldShowChangelog from './helpers/should-show-changelog';
export function activate() {
export async function activate() {
const config = Workspace.getConfiguration();
// Listen on set theme: when the theme is Material Theme, just adjust icon and accent.
@ -21,7 +21,10 @@ export function activate() {
}
if (shouldShowChangelog()) {
ThemeCommands.showChangelog();
const show = await changelogMessage();
if (show) {
ThemeCommands.showChangelog();
}
}
// Registering commands

View file

@ -2,7 +2,7 @@
"name": "vsc-material-theme",
"displayName": "Material Theme",
"description": "The most epic theme now for Visual Studio Code",
"version": "2.1.0",
"version": "2.2.0",
"publisher": "Equinusocio",
"license": "Apache-2.0",
"author": "Mattia Astorino [@equinusocio]",
@ -28,7 +28,7 @@
}
},
"scripts": {
"build": "yarn get-remote-icons && yarn build-icons && yarn build-themes && yarn build-icons-accents && yarn build-icons-variants && yarn build-icons-variants-json",
"build": "rimraf _tmp-output-remote-icons/ && yarn get-remote-icons && yarn build-icons && yarn build-themes && yarn build-icons-accents && yarn build-icons-variants && yarn build-icons-variants-json",
"minimize-icons": "mkdir icons && svgo -f src/icons/svgs -o icons/",
"minimize-json": "json-minify themes/.material-theme-icons.tmp > themes/Material-Theme-Icons.json && yarn remove-icons-tmp",
"remove-icons": "rimraf icons && rimraf themes/Material-Theme-Icons.json",
@ -214,7 +214,6 @@
"json-minify": "1.0.0",
"mustache": "2.3.0",
"ncp": "2.0.0",
"rimraf": "2.6.2",
"run-sequence": "2.2.1",
"standard-version": "4.3.0",
"svgo": "1.0.4",

View file

@ -1,4 +1,6 @@
"fileExtensions": {
"mdx": "_file_mdx",
"lnk": "_file_lnk",
"pm": "_file_perl",
"pl": "_file_perl",
"sql": "_file_sql",
@ -39,6 +41,9 @@
"css": "_file_css",
"postcss": "_file_postcss",
"pcss": "_file_postcss",
"postcssrc": "_file_postcss",
"postcss.config.js": "_file_postcss",
"postcssrc.js": "_file_postcss",
"scss": "_file_sass",
"sass": "_file_sass",
"less": "_file_less",
@ -139,6 +144,8 @@
"cpp": "_file_cpp",
"c++": "_file_cpp",
"hpp": "_file_cpp",
"hxx": "_file_cpp",
"hh": "_file_cpp",
"mm": "_file_cpp",
"cxx": "_file_cpp",
"go": "_file_go",

View file

@ -1,10 +1,10 @@
"fileNames": {
".prettierrc": "_file_prettier",
"prettier.config.js": "_file_prettier",
".prettierrc.js": "_file_prettier",
".prettierrc.json": "_file_prettier",
".prettierrc.yaml": "_file_prettier",
".prettierrc.yml": "_file_prettier",
".prettierrc": "_file_prettier",
".prettierignore": "_file_prettier",
"code_of_conduct.md": "_file_conduct",
"jest.config.js": "_file_jest",

View file

@ -5,13 +5,18 @@
"assets": "_folder_assets",
"bower_components": "_folder_bower",
"js": "_folder_js",
"css": "_folder_css",
"style": "_folder_style",
"sass": "_folder_sass",
"scss": "_folder_sass",
"src": "_folder_src",
"images": "_folder_images",
".git": "_folder_git",
".github": "_folder_github",
".vscode": "_folder_vscode",
".gulp": "_folder_gulp",
"build": "_folder_dark_build",
"gulp": "_folder_gulp",
"build": "_folder_dark_dist",
"dist": "_folder_dist"
},
"folderNamesExpanded": {
@ -23,10 +28,14 @@
"src": "_folder_src_open",
"images": "_folder_images_open",
"js": "_folder_js_open",
"css": "_folder_css_open",
"style": "_folder_css_open",
"sass": "_folder_sass_open",
"scss": "_folder_scss_open",
".git": "_folder_git_open",
".github": "_folder_github_open",
".gulp": "_folder_gulp_open",
".vscode": "_folder_vscode_open",
"build": "_folder_open_build",
"build": "_folder_open_dist",
"dist": "_folder_dist_open"
}
}

View file

@ -26,6 +26,7 @@
"statusbarForeground": "#616161",
"listHoverForeground": "#FFFFFF",
"tabActiveForeground": "#FFFFFF",
"inactiveSelectionBackground": "#00000030",
"base": {
"white": "#ffffff",
"black": "#000000",

View file

@ -28,6 +28,7 @@
"listHoverForeground": "#FFFFFF",
"listHoverBackground": "#212121",
"tabActiveForeground": "#FFFFFF",
"inactiveSelectionBackground": "#00000030",
"base": {
"white": "#ffffff",
"black": "#000000",

View file

@ -28,6 +28,7 @@
"listHoverForeground": "#FFFFFF",
"listHoverBackground": "#263238",
"tabActiveForeground": "#FFFFFF",
"inactiveSelectionBackground": "#00000030",
"base": {
"white": "#ffffff",
"black": "#000000",

View file

@ -28,6 +28,7 @@
"listHoverForeground": "#FFFFFF",
"listHoverBackground": "#263238",
"tabActiveForeground": "#FFFFFF",
"inactiveSelectionBackground": "#00000030",
"base": {
"white": "#ffffff",
"black": "#000000",

View file

@ -8,7 +8,7 @@
"contrastBorder": "#CBCBCB",
"scrollbars": "#00000040",
"sidebarForeground": "#627883",
"comments": "#90A4AE90",
"comments": "#90A4AE",
"caret": "#272727",
"findHighlight": "#FFCC00",
"foreground": "#90A4AE",
@ -28,6 +28,7 @@
"listHoverForeground": "#B1C7D3",
"listHoverBackground": "#FAFAFA",
"tabActiveForeground": "#000000",
"inactiveSelectionBackground": "#CCD7DA50",
"base": {
"white": "#FFFFFF",
"black": "#000000",

View file

@ -6,7 +6,7 @@
"background": "#FAFAFA",
"backgroundAlt": "#FAFAFA",
"contrastBorder": "#FAFAFA",
"comments": "#90A4AE90",
"comments": "#90A4AE",
"caret": "#272727",
"findHighlight": "#FFCC00",
"foreground": "#90A4AE",
@ -28,6 +28,7 @@
"listHoverForeground": "#B1C7D3",
"listHoverBackground": "#FAFAFA",
"tabActiveForeground": "#000000",
"inactiveSelectionBackground": "#CCD7DA50",
"base": {
"white": "#FFFFFF",
"black": "#000000",

View file

@ -28,6 +28,7 @@
"listHoverForeground": "#FFFFFF",
"listHoverBackground": "#292D3E",
"tabActiveForeground": "#FFFFFF",
"inactiveSelectionBackground": "#00000030",
"base": {
"white": "#ffffff",
"black": "#000000",

View file

@ -28,6 +28,7 @@
"listHoverForeground": "#FFFFFF",
"listHoverBackground": "#292D3E",
"tabActiveForeground": "#FFFFFF",
"inactiveSelectionBackground": "#00000030",
"base": {
"white": "#ffffff",
"black": "#000000",

View file

@ -28,6 +28,7 @@
"listHoverForeground": "#FFFFFF",
"listHoverBackground": "#292D3E",
"tabActiveForeground": "#FFFFFF",
"inactiveSelectionBackground": "#00000030",
"base": {
"white": "#ffffff",
"black": "#000000",

View file

@ -28,6 +28,7 @@
"listHoverForeground": "#FFFFFF",
"listHoverBackground": "#292D3E",
"tabActiveForeground": "#FFFFFF",
"inactiveSelectionBackground": "#00000030",
"base": {
"white": "#ffffff",
"black": "#000000",

View file

@ -756,7 +756,7 @@
"list.activeSelectionBackground": "{{variant.scheme.backgroundAlt}}",
"list.activeSelectionForeground": "{{commons.accents.Teal}}",
"list.inactiveSelectionForeground": "{{commons.accents.Teal}}",
"list.inactiveSelectionBackground": "#00000030",
"list.inactiveSelectionBackground": "{{variant.scheme.inactiveSelectionBackground}}",
"list.focusBackground": "{{variant.scheme.foreground}}20",
"list.focusForeground": "{{variant.scheme.foreground}}",
"list.highlightForeground": "{{commons.accents.Teal}}",
@ -787,13 +787,16 @@
"editorError.foreground": "{{variant.scheme.base.red}}70",
"editorWarning.foreground": "{{variant.scheme.base.green}}70",
"editorWidget.background": "{{variant.scheme.backgroundAlt}}",
"editor.findWidgetResizeBorder": "{{commons.accents.Teal}}",
"editorWidget.resizeBorder": "{{commons.accents.Teal}}",
"editorWidget.border": "{{variant.scheme.base.Teal}}",
"editorMarkerNavigation.background": "{{variant.scheme.foreground}}05",
"widget.shadow": "{{variant.scheme.shadow}}",
"panel.border": "{{variant.scheme.contrastBorder}}60",
"panel.background": "{{variant.scheme.backgroundAlt}}",
"panelTitle.activeForeground": "{{variant.scheme.foreground}}",
"panel.dropBackground": "{{variant.scheme.foreground}}",
"panelTitle.inactiveForeground": "{{variant.scheme.foreground}}",
"panelTitle.activeForeground": "{{variant.scheme.tabActiveForeground}}",
"panelTitle.activeBorder": "{{commons.accents.Teal}}",
"diffEditor.insertedTextBackground": "{{variant.scheme.base.green}}15",
"diffEditor.removedTextBackground": "{{variant.scheme.base.red}}20",
"notifications.background": "{{variant.scheme.background}}",
@ -819,6 +822,7 @@
"gitDecoration.modifiedResourceForeground": "{{variant.scheme.base.blue}}90",
"gitDecoration.untrackedResourceForeground": "{{variant.scheme.base.green}}90",
"gitDecoration.ignoredResourceForeground": "{{variant.scheme.sidebarForeground}}90",
"peekViewResult.selectionBackground": "{{variant.scheme.sidebarForeground}}70"
"peekViewResult.selectionBackground": "{{variant.scheme.sidebarForeground}}70",
"settings.modifiedItemForeground": "{{commons.accents.Teal}}"
}
}

View file

@ -1,79 +0,0 @@
comment — for comments.
comment.line — line comments, we specialize further so that the type of comment start character(s) can be extracted from the scope.
comment.line.double-slash — // comment
comment.line.double-dash — -- comment
comment.line.number-sign — # comment
comment.line.percentage — % comment
comment.line.character — other types of line comments.
comment.block — multi-line comments like /* … */ and <!-- … -->.
comment.block.documentation — embedded documentation.
constant — various forms of constants.
constant.numeric — those which represent numbers, e.g. 42, 1.3f, 0x4AB1U.
constant.character — those which represent characters, e.g. &lt;, \e, \031.
constant.escape — escape sequences like \e would be constant.character.escape.
constant.language — constants (generally) provided by the language which are “special” like true, false, nil, YES, NO, etc.
constant.other — other constants, e.g. colors in CSS.
entity — an entity refers to a larger part of the document, for example a chapter, class, function, or tag. We do not scope the entire entity as entity.* (we use meta.* for that). But we do use entity.* for the “placeholders” in the larger entity, e.g. if the entity is a chapter, we would use entity.name.section for the chapter title.
entity.name — we are naming the larger entity.
entity.name.function — the name of a function.
entity.name.type — the name of a type declaration or class.
entity.name.tag — a tag name.
entity.name.section — the name is the name of a section/heading.
entity.other — other entities.
entity.other.inherited-class — the superclass/baseclass name.
entity.other.attribute-name — the name of an attribute (mainly in tags).
invalid — stuff which is “invalid”.
invalid.illegal — illegal, e.g. an ampersand or lower-than character in HTML (which is not part of an entity/tag).
invalid.deprecated — for deprecated stuff e.g. using an API function which is deprecated or using styling with strict HTML.
keyword — keywords (when these do not fall into the other groups).
keyword.control — mainly related to flow control like continue, while, return, etc.
keyword.operator — operators can either be textual (e.g. or) or be characters.
keyword.other — other keywords.
markup — this is for markup languages and generally applies to larger subsets of the text.
markup.underline — underlined text.
markup.underline.link — this is for links, as a convenience this is derived from markup.underline so that if there is no theme rule which specifically targets markup.underline.link then it will inherit the underline style.
markup.bold — bold text (text which is strong and similar should preferably be derived from this name).
markup.heading — a section header. Optionally provide the heading level as the next element, for example markup.heading.2.html for <h2>…</h2> in HTML.
markup.italic — italic text (text which is emphasized and similar should preferably be derived from this name).
markup.list — list items.
markup.list.numbered — numbered list items.
markup.list.unnumbered — unnumbered list items.
markup.quote — quoted (sometimes block quoted) text.
markup.raw — text which is verbatim, e.g. code listings. Normally spell checking is disabled for markup.raw.
markup.inline.raw
markup.other — other markup constructs.
meta - the meta scope is generally used to markup larger parts of the document. For example the entire line which declares a function would be meta.function and the subsets would be storage.type, entity.name.function, variable.parameter etc. and only the latter would be styled. Sometimes the meta part of the scope will be used only to limit the more general element that is styled, most of the time meta scopes are however used in scope selectors for activation of bundle items. For example in Objective-C there is a meta scope for the interface declaration of a class and the implementation, allowing the same tab-triggers to expand differently, depending on context.
storage — things relating to “storage”.
storage.type — the type of something, class, function, int, var, etc.
storage.modifier — a storage modifier like static, final, abstract, etc.
string — strings.
string.quoted — quoted strings.
string.quoted.single — single quoted strings: 'foo'.
string.quoted.double — double quoted strings: "foo".
string.quoted.triple — triple quoted strings: """Python""".
string.quoted.other — other types of quoting: $'shell', %s{...}.
string.unquoted — for things like here-docs and here-strings.
string.interpolated — strings which are “evaluated”: `date`, $(pwd).
string.regexp — regular expressions: /(\w+)/.
string.other — other types of strings (should rarely be used).
support — things provided by a framework or library should be below support.
support.function — functions provided by the framework/library. For example NSLog in Objective-C is support.function.
support.class — when the framework/library provides classes.
support.type — types provided by the framework/library, this is probably only used for languages derived from C, which has typedef (and struct). Most other languages would introduce new types as classes.
support.constant — constants (magic values) provided by the framework/library.
support.variable — variables provided by the framework/library. For example NSApp in AppKit.
support.other — the above should be exhaustive, but for everything else use support.other.
variable — variables. Not all languages allow easy identification (and thus markup) of these.
variable.parameter — when the variable is declared as the parameter.
variable.language — reserved language variables like this, super, self, etc.
variable.other — other variables, like $some_variables.

0
test/.gitignore vendored
View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

@ -1 +0,0 @@

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

@ -1,2 +0,0 @@
#!/bin/bash
echo "$RANDOM" # Supported in bash. No warnings.

View file

View file

@ -1,2 +0,0 @@
#!/bin/sh
echo "$RANDOM" # Unsupported in sh. Produces warning.

View file

View file

View file

View file

View file

View file

View file

View file

@ -1,60 +0,0 @@
#include "ccv.h"
#include "ccv_internal.h"
#include <sys/time.h>
#ifdef HAVE_GSL
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#endif
#ifdef USE_OPENMP
#include <omp.h>
#endif
const ccv_bbf_param_t ccv_bbf_default_params = {
.interval = 5,
.min_neighbors = 2,
.accurate = 1,
.flags = 0,
.size = {
24,
24,
},
};
#define _ccv_width_padding(x) (((x) + 3) & -4)
static inline int _ccv_run_bbf_feature(ccv_bbf_feature_t *feature, int *step, unsigned char **u8)
{
#define pf_at(i) (*(u8[feature->pz[i]] + feature->px[i] + feature->py[i] * step[feature->pz[i]]))
#define nf_at(i) (*(u8[feature->nz[i]] + feature->nx[i] + feature->ny[i] * step[feature->nz[i]]))
unsigned char pmin = pf_at(0), nmax = nf_at(0);
/* check if every point in P > every point in N, and take a shortcut */
if (pmin <= nmax)
return 0;
int i;
for (i = 1; i < feature->size; i++)
{
if (feature->pz[i] >= 0)
{
int p = pf_at(i);
if (p < pmin)
{
if (p <= nmax)
return 0;
pmin = p;
}
}
if (feature->nz[i] >= 0)
{
int n = nf_at(i);
if (n > nmax)
{
if (pmin <= n)
return 0;
nmax = n;
}
}
}
#undef pf_at
#undef nf_at
return 1;
}

View file

@ -1,91 +0,0 @@
#include "ccv.h"
#include "ccv_internal.h"
#include <sys/time.h>
#ifdef HAVE_GSL
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#endif
#ifdef USE_OPENMP
#include <omp.h>
#endif
const ccv_bbf_param_t ccv_bbf_default_params = {
.interval = 5,
.min_neighbors = 2,
.accurate = 1,
.flags = 0,
.size = {
24,
24,
},
};
#define _ccv_width_padding(x) (((x) + 3) & -4)
static inline int _ccv_run_bbf_feature(ccv_bbf_feature_t* feature, int* step, unsigned char** u8)
{
#define pf_at(i) (*(u8[feature->pz[i]] + feature->px[i] + feature->py[i] * step[feature->pz[i]]))
#define nf_at(i) (*(u8[feature->nz[i]] + feature->nx[i] + feature->ny[i] * step[feature->nz[i]]))
unsigned char pmin = pf_at(0), nmax = nf_at(0);
/* check if every point in P > every point in N, and take a shortcut */
if (pmin <= nmax)
return 0;
int i;
for (i = 1; i < feature->size; i++)
{
if (feature->pz[i] >= 0)
{
int p = pf_at(i);
if (p < pmin)
{
if (p <= nmax)
return 0;
pmin = p;
}
}
if (feature->nz[i] >= 0)
{
int n = nf_at(i);
if (n > nmax)
{
if (pmin <= n)
return 0;
nmax = n;
}
}
}
#undef pf_at
#undef nf_at
return 1;
}
static int _ccv_read_bbf_stage_classifier(const char* file, ccv_bbf_stage_classifier_t* classifier)
{
FILE* r = fopen(file, "r");
if (r == 0) return -1;
int stat = 0;
stat |= fscanf(r, "%d", &classifier->count);
union { float fl; int i; } fli;
stat |= fscanf(r, "%d", &fli.i);
classifier->threshold = fli.fl;
classifier->feature = (ccv_bbf_feature_t*)ccmalloc(classifier->count * sizeof(ccv_bbf_feature_t));
classifier->alpha = (float*)ccmalloc(classifier->count * 2 * sizeof(float));
int i, j;
for (i = 0; i < classifier->count; i++)
{
stat |= fscanf(r, "%d", &classifier->feature[i].size);
for (j = 0; j < classifier->feature[i].size; j++)
{
stat |= fscanf(r, "%d %d %d", &classifier->feature[i].px[j], &classifier->feature[i].py[j], &classifier->feature[i].pz[j]);
stat |= fscanf(r, "%d %d %d", &classifier->feature[i].nx[j], &classifier->feature[i].ny[j], &classifier->feature[i].nz[j]);
}
union { float fl; int i; } flia, flib;
stat |= fscanf(r, "%d %d", &flia.i, &flib.i);
classifier->alpha[i * 2] = flia.fl;
classifier->alpha[i * 2 + 1] = flib.fl;
}
fclose(r);
return 0;
}
#ifdef HAVE_GSL

View file

@ -1,60 +0,0 @@
#include "ccv.h"
#include "ccv_internal.h"
#include <sys/time.h>
#ifdef HAVE_GSL
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#endif
#ifdef USE_OPENMP
#include <omp.h>
#endif
const ccv_bbf_param_t ccv_bbf_default_params = {
.interval = 5,
.min_neighbors = 2,
.accurate = 1,
.flags = 0,
.size = {
24,
24,
},
};
#define _ccv_width_padding(x) (((x) + 3) & -4)
static inline int _ccv_run_bbf_feature(ccv_bbf_feature_t *feature, int *step, unsigned char **u8)
{
#define pf_at(i) (*(u8[feature->pz[i]] + feature->px[i] + feature->py[i] * step[feature->pz[i]]))
#define nf_at(i) (*(u8[feature->nz[i]] + feature->nx[i] + feature->ny[i] * step[feature->nz[i]]))
unsigned char pmin = pf_at(0), nmax = nf_at(0);
/* check if every point in P > every point in N, and take a shortcut */
if (pmin <= nmax)
return 0;
int i;
for (i = 1; i < feature->size; i++)
{
if (feature->pz[i] >= 0)
{
int p = pf_at(i);
if (p < pmin)
{
if (p <= nmax)
return 0;
pmin = p;
}
}
if (feature->nz[i] >= 0)
{
int n = nf_at(i);
if (n > nmax)
{
if (pmin <= n)
return 0;
nmax = n;
}
}
}
#undef pf_at
#undef nf_at
return 1;
}

View file

View file

File diff suppressed because it is too large Load diff

View file

@ -1,259 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Microsoft.Win32;
using Shadowsocks.Controller;
namespace Shadowsocks.Util
{
public struct BandwidthScaleInfo
{
public float value;
public string unitName;
public long unit;
public BandwidthScaleInfo(float value, string unitName, long unit)
{
this.value = value;
this.unitName = unitName;
this.unit = unit;
}
}
public static class Utils
{
private static string _tempPath = null;
// return path to store temporary files
public static string GetTempPath()
{
if (_tempPath == null)
{
try
{
Directory.CreateDirectory(Path.Combine(Application.StartupPath, "ss_win_temp"));
// don't use "/", it will fail when we call explorer /select xxx/ss_win_temp\xxx.log
_tempPath = Path.Combine(Application.StartupPath, "ss_win_temp");
}
catch (Exception e)
{
Logging.Error(e);
throw;
}
}
return _tempPath;
}
// return a full path with filename combined which pointed to the temporary directory
public static string GetTempPath(string filename)
{
return Path.Combine(GetTempPath(), filename);
}
public static void ReleaseMemory(bool removePages)
{
// release any unused pages
// making the numbers look good in task manager
// this is totally nonsense in programming
// but good for those users who care
// making them happier with their everyday life
// which is part of user experience
GC.Collect(GC.MaxGeneration);
GC.WaitForPendingFinalizers();
if (removePages)
{
// as some users have pointed out
// removing pages from working set will cause some IO
// which lowered user experience for another group of users
//
// so we do 2 more things here to satisfy them:
// 1. only remove pages once when configuration is changed
// 2. add more comments here to tell users that calling
// this function will not be more frequent than
// IM apps writing chat logs, or web browsers writing cache files
// if they're so concerned about their disk, they should
// uninstall all IM apps and web browsers
//
// please open an issue if you're worried about anything else in your computer
// no matter it's GPU performance, monitor contrast, audio fidelity
// or anything else in the task manager
// we'll do as much as we can to help you
//
// just kidding
SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle,
(UIntPtr)0xFFFFFFFF,
(UIntPtr)0xFFFFFFFF);
}
}
public static string UnGzip(byte[] buf)
{
byte[] buffer = new byte[1024];
int n;
using (MemoryStream sb = new MemoryStream())
{
using (GZipStream input = new GZipStream(new MemoryStream(buf),
CompressionMode.Decompress,
false))
{
while ((n = input.Read(buffer, 0, buffer.Length)) > 0)
{
sb.Write(buffer, 0, n);
}
}
return System.Text.Encoding.UTF8.GetString(sb.ToArray());
}
}
public static string FormatBandwidth(long n)
{
var result = GetBandwidthScale(n);
return $"{result.value:0.##}{result.unitName}";
}
public static string FormatBytes(long bytes)
{
const long K = 1024L;
const long M = K * 1024L;
const long G = M * 1024L;
const long T = G * 1024L;
const long P = T * 1024L;
const long E = P * 1024L;
if (bytes >= P * 990)
return (bytes / (double)E).ToString("F5") + "EiB";
if (bytes >= T * 990)
return (bytes / (double)P).ToString("F5") + "PiB";
if (bytes >= G * 990)
return (bytes / (double)T).ToString("F5") + "TiB";
if (bytes >= M * 990)
{
return (bytes / (double)G).ToString("F4") + "GiB";
}
if (bytes >= M * 100)
{
return (bytes / (double)M).ToString("F1") + "MiB";
}
if (bytes >= M * 10)
{
return (bytes / (double)M).ToString("F2") + "MiB";
}
if (bytes >= K * 990)
{
return (bytes / (double)M).ToString("F3") + "MiB";
}
if (bytes > K * 2)
{
return (bytes / (double)K).ToString("F1") + "KiB";
}
return bytes.ToString() + "B";
}
/// <summary>
/// Return scaled bandwidth
/// </summary>
/// <param name="n">Raw bandwidth</param>
/// <returns>
/// The BandwidthScaleInfo struct
/// </returns>
public static BandwidthScaleInfo GetBandwidthScale(long n)
{
long scale = 1;
float f = n;
string unit = "B";
if (f > 1024)
{
f = f / 1024;
scale <<= 10;
unit = "KiB";
}
if (f > 1024)
{
f = f / 1024;
scale <<= 10;
unit = "MiB";
}
if (f > 1024)
{
f = f / 1024;
scale <<= 10;
unit = "GiB";
}
if (f > 1024)
{
f = f / 1024;
scale <<= 10;
unit = "TiB";
}
return new BandwidthScaleInfo(f, unit, scale);
}
public static RegistryKey OpenRegKey(string name, bool writable, RegistryHive hive = RegistryHive.CurrentUser)
{
// we are building x86 binary for both x86 and x64, which will
// cause problem when opening registry key
// detect operating system instead of CPU
if (name.IsNullOrEmpty()) throw new ArgumentException(nameof(name));
try
{
RegistryKey userKey = RegistryKey.OpenBaseKey(hive,
Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32)
.OpenSubKey(name, writable);
return userKey;
}
catch (ArgumentException ae)
{
MessageBox.Show("OpenRegKey: " + ae.ToString());
return null;
}
catch (Exception e)
{
Logging.LogUsefulException(e);
return null;
}
}
public static bool IsWinVistaOrHigher()
{
return Environment.OSVersion.Version.Major > 5;
}
[DllImport("kernel32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool SetProcessWorkingSetSize(IntPtr process,
UIntPtr minimumWorkingSetSize, UIntPtr maximumWorkingSetSize);
// See: https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx
public static bool IsSupportedRuntimeVersion()
{
/*
* +-----------------------------------------------------------------+----------------------------+
* | Version | Value of the Release DWORD |
* +-----------------------------------------------------------------+----------------------------+
* | .NET Framework 4.6.2 installed on Windows 10 Anniversary Update | 394802 |
* | .NET Framework 4.6.2 installed on all other Windows OS versions | 394806 |
* +-----------------------------------------------------------------+----------------------------+
*/
const int minSupportedRelease = 394802;
const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
using (var ndpKey = OpenRegKey(subkey, false, RegistryHive.LocalMachine))
{
if (ndpKey?.GetValue("Release") != null)
{
var releaseKey = (int)ndpKey.GetValue("Release");
if (releaseKey >= minSupportedRelease)
{
return true;
}
}
}
return false;
}
}
}

View file

@ -1,61 +0,0 @@
body {
font-family: arial;
}
h1, p, table {
background-color:#CCC;
border: 1px solid;
color:#39F;
text-align: center;
width: 100%;
}
.addon-store .pagehead h1
.addon-store .addon-summary:after { clear: both }
#addon-store .pagehead .electrocat-small {
bottom: -7px;
position: absolute;
right: 0;
}
.addon-store .addons-nav a.selected {
border-bottom-color: #d26911;
color: #333;
font-weight: bold;
padding: 0 0 14px;
}
.addon-store .addon-icon {
background: #fff;
border: 1px solid #ddd;
box-shadow: 0 1px 2px rgba(0,0,0,0.15);
float: left;
height: 80px;
margin-right: 14px;
width: 80px;
}
.addon-store .developer-callout {
background-color: #f1f1f1;
background-image: -moz-linear-gradient(#fafafa, #f1f1f1);
background-image: -webkit-linear-gradient(#fafafa, #f1f1f1);
background-image: linear-gradient(#fafafa, #f1f1f1);
background-repeat: repeat-x;
border: 1px solid #ddd;
border-bottom: 1px solid #ccc;
border-radius: 3px;
box-shadow: inset 0 1px 0 #fff, 0 1px 5px #f1f1f1;
margin-top: 40px;
text-shadow: 0 1px 0 #fff;
}
.addon-field-editor .addon-field-list, .addon-field-editor .addon-new-field {
-moz-box-sizing: border-box;
border-radius: 3px;
box-sizing: border-box;
display: inline-block;
text-align: center;
width: 595px;
}

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

View file

Some files were not shown because too many files have changed in this diff Show more